简体   繁体   English

隐藏应用程序窗口的一部分?

[英]Hide part of the application window?

I wanted to be able to hide part of my application window to display only the 3 buttons at the bottom and the status bar. 我希望能够隐藏我的应用程序窗口的一部分,以便仅在底部和状态栏上显示3个按钮。

Currently I was trying to do it by changing the heigth of the window but it does not seem like a correct way to do this. 目前,我正在尝试通过更改窗口的高度来做到这一点,但这似乎不是正确的方法。

For example if I have a windows form that has a menu bar, a status bar, and between the both i have a listview and the 3 buttons near the bottom, changing the height of the window will allow the user to risize it, will not show the buttons as there was the listview before so it would show only part of the list view and the status bar. 例如,如果我有一个带有菜单栏,状态栏的窗口窗体,并且在两者之间都有一个列表视图和靠近底部的3个按钮,则更改窗口的高度将允许用户抬高它,而不会显示按钮,因为之前没有列表视图,因此它仅显示部分列表视图和状态栏。

Here is an example of what it happens if i use the height resize: 这是如果我使用高度调整大小会发生什么的示例: 替代文字

Not so far from how I wanted it to look like but the buttons are missing and I would need to lock the window so the user can't resize it. 离我想要的样子不远,但是按钮丢失了,我需要锁定窗口,以便用户无法调整其大小。

1) Make sure the three buttons have the Anchor property set to "Bottom, Right". 1)确保三个按钮的Anchor属性都设置为“ Bottom,Right”。

2) Set the form's FormBorderStyle to "FixedSingle" (or similar, see http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formborderstyle.aspx ). 2)将表单的FormBorderStyle设置为“ FixedSingle”(或类似的内容,请参见http://msdn.microsoft.com/zh-cn/library/system.windows.forms.form.formborderstyle.aspx )。 Set the form's SizeGripStyle to "Hide". 将窗体的SizeGripStyle设置为“隐藏”。

3) To change the height: 3)更改高度:

Smaller: this.Height -= listView.height; 较小: this.Height -= listView.height;

Larger: this.Height += listView.height; 更大: this.Height += listView.height;

Hope this helps. 希望这可以帮助。

听起来您在寻找MinimumSize属性。

如何将listview的anchor属性设置为left,right,top和bottom,并将按钮的anchor属性设置为right + bottom?

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

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