winform 程序运行过程中,用户用鼠标拖动窗体大小时,如将窗体调整得极小,可能窗体上的控件就面目全非(或看不到了),用下面的代码可以设定窗口的最小尺寸,以防止这种情况
private void Form1_ResizeEnd(object sender, EventArgs e)
{
//this.Text = "2" + this.Width.ToString() + " height:" + this.Height.ToString();
if (this.Width <= 250) {
this.Width = 250;
}
if (this.Height <= 250)
{
this.Height = 250;
}
}
{
//this.Text = "2" + this.Width.ToString() + " height:" + this.Height.ToString();
if (this.Width <= 250) {
this.Width = 250;
}
if (this.Height <= 250)
{
this.Height = 250;
}
}