private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.notifyIcon1.Visible = true;
}
}
//显示
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true; //设置任务栏是否显示
this.Activate();
}
//隐藏
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
}
//退出
private void toolStripMenuItem3_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("确定要?", "安全提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
notifyIcon1.Visible = false;
this.Close();
this.Dispose();
Application.Exit();
}
}
winform右键菜单设置
最新推荐文章于 2024-05-22 02:08:08 发布