Problem with layout of control when dynamically creating winform and controls for the Form

Posted by Ashwani Roy on Stack Overflow See other posts from Stack Overflow or by Ashwani Roy
Published on 2011-06-21T19:46:05Z Indexed on 2011/06/22 0:22 UTC
Read the original article Hit count: 237

Filed under:
|

I get this response from a web service call. Something like this

<Response>
<Control1 type = "DropdownList" value= "USA,UK,Sweden,UAE"/>
<Control2 type = "Textbox" value= "Contries"/>
<Control3 type = "Button" value= "None">
</Response>

Based on this I de-serialize it into List<Controls>.

Now I need to be able to dynamically create a winform based on these controls. My problem is the layout. I want to be able to create them nicely separated (If possible vertically aligned) in batches of lets say 5.So If I need 15 controls I have 3 columns and 5 rows. What would be best way to achieve this? I know that I can use the inbuilt positioning properties like top, width etc., but maybe someone out there has done something similar in a better way.

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms