我在事件中设置控件的随form的大小而改变,怎么不管用呢this.groupBox1.Anchor = AnchorStyles.Bottom;
this.groupBox1.Anchor = AnchorStyles.Left;
this.groupBox1.Anchor = AnchorStyles.Right;
this.groupBox1.Anchor = AnchorStyles.Top;在初始化窗口时是可以的,
this.groupBox1.Anchor = AnchorStyles.Left;
this.groupBox1.Anchor = AnchorStyles.Right;
this.groupBox1.Anchor = AnchorStyles.Top;在初始化窗口时是可以的,
然后往TableLayoutPanel中添加GroupBox 并且设置GroupBox1.Dock=DockStyle.Fill;
if (zdh.Text == "最大化")
{
GBWidth=this.groupBox1.Width;
GBHeight = this.groupBox1.Height;
this.groupBox1.Dock = DockStyle.Fill;
//this.impbt.Visible = false;
zdh.Text = "最小化";
}
else
{
this.groupBox1.Dock = DockStyle.None;
//this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
zdh.Text = "最大化";
}
if (zdh.Text == "最大化")
{
this.dataGridView1.Width = 100;
this.dataGridView1.Height = 100;
}
else
{
this.dataGridView1.Width = 5;
this.dataGridView1.Height = 5;
}