简体   繁体   中英

How to reserve space in Win Form TableLayoutPanel control

I have a question about WinForm TableLayoutPanel control. For example, if I hide the control in the column. it will change the size.

Is there a way to not paint the control in a tablelayoutpanel with column autosize so that the column will still have the control size?

Using Control.Visible = false will make the column width 0.

I need something like hidden in WPF Grid .

You can place a Panel in the TLP and place the control on the panel. Set the panel's background color to the same as the TLP, and it will be invisible. Then hide the control but leave the panel.

This should work fine if your control is a fixed size. If the control size varies, it might be a bit more tricky to do this. You will need to vary the size of the Panel too. Setting it to AutoSize = true and AutoSizeMode = GrowOnly might work.

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