Winforms, creating padding when using Dock properties.

Posted by Zka on Stack Overflow See other posts from Stack Overflow or by Zka
Published on 2010-04-29T13:15:08Z Indexed on 2010/04/29 13:17 UTC
Read the original article Hit count: 526

Filed under:
|
|

How do I add padding, or some space between the textboxes when using dockstyle.top property?

for(int i =0; i< 10; i++) {
    textboxes[i] = new TextBox();
    textboxes[i].Dock = DockStyle.Top;
    mypanel.Controls.Add(textboxes[i]); 
}

The code above puts textboxes right beneath each other. Can't figure this out without using mass panels or fixed positioning. How to do the following?

1) I would like to add around 10-20pixels between boxes.

2) How to change size (height,width) of the textboxes, since when using dockstyle.top it ignores the size commands ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms