Results 1 to 5 of 5

Thread: Getting datagrid controls to resize automatically

  1. #1

    Thread Starter
    Hyperactive Member r0k3t's Avatar
    Join Date
    Dec 2005
    Location
    Cleveland
    Posts
    361

    Getting datagrid controls to resize automatically

    Hi there,

    I am trying to figure out how to get a datagrid control to resize when someone enlarges the form that is is on? I would assume this is fairly easy but I can't seem to see it? Hmm...

    Thanks

  2. #2
    Hyperactive Member
    Join Date
    May 2005
    Posts
    334

    Re: Getting datagrid controls to resize automatically

    Well, I don't know much about datagrids but you'd probably put the code to resize the grid into the form's Resize event procedure. The obvious method would be to set the grid's Height & Width properties to some fraction of the form's but there might be an easier way. (Even more so if you're dealing with multiple controls as you'd probably need to reposition them, too.)

  3. #3
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: Getting datagrid controls to resize automatically

    Try setting the anchors for the control. If you want it to resize in all directions then turn on all anchors, this will make it change with the size of the form. Or there is always docking if you just want it to fill the form.
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

  4. #4
    Addicted Member
    Join Date
    Mar 2006
    Posts
    235

    Re: Getting datagrid controls to resize automatically

    On the form resize

    VB Code:
    1. dgvResults.Size = New Size(Me.Width, Me.Height)

  5. #5

    Thread Starter
    Hyperactive Member r0k3t's Avatar
    Join Date
    Dec 2005
    Location
    Cleveland
    Posts
    361

    Re: Getting datagrid controls to resize automatically

    Ahh, thanks much all, anchors are the trick!!!

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