开发者

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. However, when the window is maximized, it ends up looking like this:

How can I make a control resize itself when the window is maximized?

What I want is for both the "Log" group box and the ta开发者_StackOverflow中文版b 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. 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;
   }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜