automatic resizing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • necro1000
    New Member
    • Apr 2008
    • 12

    automatic resizing

    Hi all,

    I am using an MDI Container for the creation of my app but I need to automatically resize my controls according to the size of the child form.

    If I set the Anchor properties of all the controls (a datagridview, a textbox and two buttons), the end result is nowhere near what I actually need cause the items just resize without keeping their positions.

    Any ideas please???

    Thanks
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Use the control's location and size properties.
    Place the first control in the upper left corner (or where ever you consider home)
    Size it.
    Place the next control's location 3 pixels to the right of the first control's bounds.right property.
    and so on
    and so on
    and so on

    Comment

    • GaryTexmo
      Recognized Expert Top Contributor
      • Jul 2009
      • 1501

      #3
      Anchor should work, but it's a touch tricky and it depends on what you actually want to accomplish with your control placement.

      You've described your datagridview, textbox, and two buttons, but how are they organized and how do they mess up when you move them? I was able to put together a form with those controls and have it resize with everything coming out normally using just anchor, so I'm guessing you've got something different than me?

      I have things set up as follows...

      DataGridView
      TextBox
      Button1 Button2

      ... and anchored as follows...

      DataGridView - All edges
      TextBox - Left, Right, and Bottom
      Button1 and Button2 - Bottom and Right

      Comment

      Working...