dispaly controls in panel

  • Thread starter Thread starter keith
  • Start date Start date
K

keith

I have a panel on my form and add controls (e.g. TextBox)
into it at runtime.

What I want is the controls will display on same line if
they are visiable in the panel horizontally. If any of
the controls outside panel, it will be displayed to next
line.

Is there any property I can set in the panel to do it?

Thanks

Kieht
 
I think it depends on how your form is configured. Are you using GridLayout
or FlowLayout ?
If you use FlowLayout and don't set fixed width and height of your panel,
the controls should wrap to the next line in case they don't fit.
 
How to I know which one for my form (I created an Window
app with all default) and how to change it?

Thanks
Keith
 
Wait a minute .. Windows app ?? I thought you were talking about a ASP.NET
webform :)
Ok, then you'll have to verify programmatically the position and width of
the child controls and move to the next "line" in the panel.
I suggest using private fields to keep track of the current X and Y
coordinates of the last added control. Also, the ControlAdded event might
help you out.
 
Back
Top