/// <summary>
/// 退出系统
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripButton3_Click(object sender, EventArgs e)
{
try
{
DialogResult result = MessageBox.Show("确定要退出系统吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result == DialogResult.OK)
{
this.Close();
Application.ExitThread();
}
else
{
}
}
catch { }
}
/// <summary>
/// 还原
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripButton4_Click(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
else
{
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
}
}
/// <summary>
/// 最小化
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripButton5_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
/// <summary>
/// 移动
/// </summary>
private Point mPoint;
private void toolStrip1_MouseDown(object sender, MouseEventArgs e)
{
mPoint = new Point(e.X, e.Y);
}
private void toolStrip1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Location = new Point(this.Location.X + e.X - mPoint.X, this.Location.Y + e.Y - mPoint.Y);
}
}
C#winform窗体(关闭、缩小、还原、移动)
最新推荐文章于 2024-08-06 10:13:21 发布