开发者

How to create an overlay part of control in Winforms C#?

开发者 https://www.devze.com 2023-03-13 09:01 出处:网络
I need to create a custom control that has an expandable part as a panel and a textbox part. The expandable part is a panel, that will either be visible or invisible. But when the panel is visible/exp

I need to create a custom control that has an expandable part as a panel and a textbox part. The expandable part is a panel, that will either be visible or invisible. But when the panel is visible/expanded directly under the textbox, I do not want the adjacent controls to shift down below the panel, but the panel should just overlay the controls that are there just under the custom control. How would I implement this in Winforms C# project? I am open to using user control for this scenario.

Thanks Sun开发者_StackOverflow中文版il


I think your implementation of expanding and collapsing is not the best, because you are just overlaying the controls instead of hiding them. One of the disadvantages is that the overlaid controls might by focussed by pressing tab and they might have a value which I think it is out of target.

I would suggest another implementation by creating two panels (one for the header and another one for the content) and when the collapse button is pressed then the content's panel will be hidden by sitting its Visible property to false and its Hight to 0.

0

精彩评论

暂无评论...
验证码 换一张
取 消