简体   繁体   English

如何使面板在Visual WebGUI中以最小和最大宽度为中心?

[英]How to make a panel centered with minimum and maximum width in Visual WebGUI?

I would like to make a panel with this behaviour in Visual WebGUI. 我想在Visual WebGUI中制作一个具有这种行为的面板。

if window's width is smaller than minimal width of the panel, scrollbar appears. 如果窗口的宽度小于面板的最小宽度,则会出现滚动条。 if window's width is bigger than minimal width of the panel, the panel fill the width of the window. 如果窗口的宽度大于面板的最小宽度,则面板将填充窗口的宽度。 if window's width is bigger than maximal width of the panel, panel remains at maximal width and sides of the window are empty. 如果窗口的宽度大于面板的最大宽度,则面板将保持最大宽度,并且窗口的侧面为空。

Panel needs to be always in the center of the window. 面板必须始终位于窗口的中央。

How can I achieve that ? 我该如何实现? Thank you 谢谢

Create a panel. 创建一个面板。 Set the Dock = Fill for the panel. 设置面板的Dock = Fill。 Set the MinimumSize property of the panel to your desired width and height. 将面板的MinimumSize属性设置为所需的宽度和高度。

Now put any controls inside the panel. 现在将所有控件放入面板中。 But set the controls anchor property to None. 但是将控件的定位器属性设置为“无”。

This way your controls will always be centered and scrollbars will be visible as you desired. 这样,您的控件将始终居中,并且可以根据需要显示滚动条。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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