Results 1 to 2 of 2

Thread: Resizing MSFlexGrid Control ... not the rows/columns

  1. #1

    Thread Starter
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Why not resize the Grid as the containing Form is resized, i.e.
    VB Code:
    1. Private Sub Form_Resize()
    2.     MSFlexGrid1.Move 0, 0, ScaleWidth, ScaleHeight
    3. End Sub
    If the control is on the form with other controls, then just make it stretch with the Form, i.e.
    VB Code:
    1. Private tFormWidth As Single, tFormHeight As Single
    2. Private tGridWidth As Single, tGridHeight As Single
    3.  
    4. Private Sub Form_Load()
    5.     tFormWidth = ScaleWidth
    6.     tFormHeight = ScaleHeight
    7.     tGridWidth = MSFlexGrid1.Width
    8.     tGridHeight = MSFlexGrid1.Height
    9. End Sub
    10.  
    11. Private Sub Form_Resize()
    12.     ' Trap error caused if Width/Height are invalid
    13.     On Error Resume Next
    14.     MSFlexGrid1.Width = tGridWidth + (ScaleWidth - tFormWidth)
    15.     MSFlexGrid1.Height = tGridHeight + (ScaleHeight - tFormHeight)
    16. End Sub

  2. #2
    Junior Member
    Join Date
    Nov 2001
    Location
    Two Harbors, MN
    Posts
    24

    Cool

    Thank you! That was simple enough. I do have other controls on the form; I will give it a try.

    Thanks again!
    Programming Animal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width