vb Code:
  1. Private Sub Form_Load()
  2.    
  3.     Dim sinHeight As Single, sinWidth As Single
  4.    
  5.     sinHeight = Me.ScaleY(Me.Height, vbTwips, vbPixels) - Me.ScaleHeight
  6.     sinWidth = Me.ScaleX(Me.Width, vbTwips, vbPixels) - Me.ScaleWidth
  7.    
  8.     Me.Width = Me.ScaleX(cmdApply.Left + cmdApply.Width + (GRID_UNIT * 2) + sinWidth, vbPixels, vbTwips)
  9.     Me.Height = Me.ScaleY(cmdApply.Top + cmdApply.Height + (GRID_UNIT * 2) + sinHeight, vbPixels, vbTwips)
  10.    
  11. End Sub