0

I have a flowlayoutpanel, on which there are some UserControls, which are being dragged and dropped in flowlayoutpanel. I need my controls - userCOntrols to auto resize when resizing the window itself. I need that Usercontrols to be resized automatically when resizing the form. What can you offer ?

Romo Daneghyan
  • 2,099
  • 3
  • 18
  • 23

1 Answers1

0

You should use the Dock Property for that.

How to dock a control:

  1. Select the control that you want to dock.
  2. In the Properties window, click the arrow to the right of the Dock property. An editor is displayed that shows a series of boxes representing the edges and the center of the form.
  3. Click the button that represents the edge of the form where you want to dock the control. To fill the contents of the control's form or container control, click the center box. Click (none) to disable docking.

The control is automatically resized to fit the boundaries of the docked edge.

Community
  • 1
  • 1
Steven Borges
  • 401
  • 1
  • 3
  • 16
  • Thanks but I am not working with Designer. The user controls are added to form with code. And I did that with code,but when resizing the form nothing happens – Romo Daneghyan Apr 23 '14 at 12:18
  • 1
    Didn't knew you weren't using the designer. Normaly it should work, sure you used the implementation from [this documentation](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dock%28v=vs.110%29.aspx)? – Steven Borges Apr 23 '14 at 12:19
  • I looked carefully. Not working :/ Is there any way to do it ? maybe with sizeChanged event on Form ? – Romo Daneghyan Apr 23 '14 at 12:35
  • Have you docked the flowlayoutpanel to the form, and then your user controls to the flowlayoutpanel? – George T Apr 23 '14 at 12:49
  • Can't help you further, it should work with user controls aswell, are you sure you docked on the correct places? Sometimes people make a mistake and only dock left, which isn't affected when resizing the height. – Steven Borges Apr 23 '14 at 13:09