Winform判断是否点击窗口最大化和还原按钮
FormWindowState tempWindowState; private void frmMain_SizeChanged(object sender, EventArgs e) { if (tempWindowState != FormWindowState.Maximized && this.WindowState == FormWindowState.Maximized)//点击最大化 { tempWindowState = FormWindowState.Maximized; this.Text = "普通变为最大化"; // SetPictureBoxCenter(); } else if (tempWindowState == FormWindowState.Maximized && this.WindowState == FormWindowState.Normal)//窗口由最大化还原为普通 { tempWindowState = FormWindowState.Normal; this.Text = "最大化还原为普通"; //SetPictureBoxCenter(); }