Form窗体实现SizeChange函数:
private void FormLaboratoryProcessHandMore2_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)//当窗体的状态是最小化时触发
{
//MessageBox.Show("test", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
//以下三句代码是回到桌面的功能,调用了Windows系统命令
Type shellType = Type.GetTypeFromProgID("Shell.Application");
object shellObject = System.Activator.CreateInstance(shellType);
shellType.InvokeMember("ToggleDesktop", System.Reflection.BindingFlags.InvokeMethod, null, shellObject, null);
}
}