简体   繁体   中英

c# winforms evenly distribute 3 controls

i have 3 custom controls, that i want to place in a resizable window next to each other. when the window is being resized, these controls should also resize, each taking 33% of the available width.

i tried to use a table layout, but it seems the table only grows, but never shrinks.

thanks for any help on this!

You can use a TableLayoutPanel, with 3 columns each of size "33% percent". Then you put each of your control in the panel, and set the anchor property as you wish (for example right-left if your control should resize themselves only on the horizontal plane).

Your TableLayoutPanel should also have its property Dock set to True so that he can occupy all your window and resize accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM