form最小化后,再还原,是什么事件触发?

2025-03-10 15:24:49
推荐回答(1个)
回答1:

this.SizeChanged 事件
测试代码如下所示:
public Form5()
{
InitializeComponent();
this.SizeChanged += new EventHandler(Form5_SizeChanged);
}

void Form5_SizeChanged(object sender, EventArgs e)
{

if (this.WindowState == FormWindowState.Normal)
{
this.Text = "窗体还原,时间:" + DateTime.Now.ToString();
}
}

//1.最小化

//WindowState = FormWindowState.Minimized;

////最小化时隐藏窗体

//this.Visible=false;

//2.最大化

//WindowState == FormWindowState.Maximized;

//3.还原为正常

//WindowState == FormWindowState.Normal;