[英]How can I make a control resize itself when the window is maximized?
I can't seem to figure this out.我似乎无法弄清楚这一点。 I have two group boxes on the left side of my form window.
我的表单窗口左侧有两个组框。 When the window is normal size (1000x700), the two boxes are the same.
当窗口为正常大小(1000x700)时,两个框是一样的。 However, when the window is maximized, it ends up looking like this:
但是,当窗口最大化时,它最终看起来像这样:
What I want is for both the "Log" group box and the tab control to extend down to the bottom of the window.我想要的是“日志”组框和选项卡控件都向下延伸到窗口底部。 I have tried messing with anchoring, but that just seems to move it and not resize it.
我试过搞乱锚定,但这似乎只是移动它而不是调整它的大小。 Docking fills the whole side.
对接填满整个侧面。 What options do I have here?
我在这里有哪些选择?
Make Log's制作日志
Anchor property= Top|Left|Bottom.
Make tab control's制作选项卡控件
Anchor property = Top|Left|Bottom|Right
If you anchor to the top, it'll move the whole control up and down.如果您锚定到顶部,它将上下移动整个控件。 If you anchor to top+bottom, it'll stretch the control so that it grows as the form grows.
如果您锚定到顶部+底部,它会拉伸控件,使其随着表单的增长而增长。
You could change the Max
property along with the other event changed.您可以在更改其他事件的同时更改
Max
属性。 Check this:检查这个:
private void frm_Resize(object sender, EventArgs e)
{
if (this.ParentForm.WindowState == FormWindowState.Normal &&
this.WindowState == FormWindowState.Maximized)
{
this.ParentForm.WindowState = FormWindowState.Maximized;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.