Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make UserControl resize when Dock = Fill

I have a problem with UserControl that I'm crafting. It consists of TableLayoutPanel with another TableLayoutPanel in it with ListView inside. I want to make it resizable so that it will fit in left panel of my app and behave somewhat like Toolbox in Visual Studio. The problem is that my control doesn't scale when I resize panel.

UserControl is embedded in panel with Dock = Fill and Anchor = Tob, Left, Bottom, Right. Also all controls in it are made that way. How can I fix this?

EDIT: It's WinForms, not XAML.

like image 206
Migol Avatar asked May 15 '26 04:05

Migol


1 Answers

You're probably looking for the AutoSize properties on the TableLayoutPanel and the AutoSize ColumnType of that panel. You can achieve something like a Dock = Fill by simply auto-sizing the table layout panel (GrowAndShrink) so that it will always fit your inner control. Please post your designer code to see how you embedded the controls in which other control.

like image 161
Matt Ko Avatar answered May 16 '26 16:05

Matt Ko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!