简体   繁体   English

如何防止面板更改其子控件的大小

[英]How to prevent panel from changing its children controls' sizes

I have a panel which is hosting a Treeview and a User Control. 我有一个主持Treeview和用户控件的面板。 The panel itself is residing within a window form. 面板本身位于窗口窗体内。 When I maximize the window form, the panel size get changed automatically and the Treeview within it. 当我最大化窗口窗体时,面板大小会自动更改,并且其中的Treeview也将自动更改。

Is there a way to prevent the panel from changing the children control within it automatically? 有没有办法防止面板自动更改其中的子控件?

I am using visual studio 2008 and C# language. 我正在使用Visual Studio 2008和C#语言。

Thanks 谢谢

Set the TreeView .Anchor property to None. 将TreeView .Anchor属性设置为None。 If the .Dock property has a value set it to None also. 如果.Dock属性的值也设置为None。 These two properties represent auto-resize features of a control relevant its parent container (which in your case is the Panel) 这两个属性表示控件与其父容器(在您的情况下是面板)相关的自动调整大小功能

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

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