首页 > 代码库 > winform图标最小化显示在任务栏右下角
winform图标最小化显示在任务栏右下角
http://www.cnblogs.com/shenyixin/archive/2013/07/05/3173640.html
private
void
Form1_SizeChanged(
object
sender, EventArgs e)
{
if
(
this
.WindowState == System.Windows.Forms.FormWindowState.Minimized)
{
this
.Hide();
this
.notifyIcon1.Visible =
true
;
}
if
(
this
.WindowState == FormWindowState.Normal)
{
this
.notifyIcon1.Visible =
false
;
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing)//当用户点击窗体右上角X按钮或(Alt + F4)时 发生 { e.Cancel = true; this.ShowInTaskbar = false; this.myIcon.Icon = this.Icon; this.Hide(); } } private void myIcon_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { myMenu.Show(); } if (e.Button == MouseButtons.Left) { this.Visible = true; this.WindowState = FormWindowState.Normal; } } private void toolMenuCancel_Click(object sender, EventArgs e) { Application.Exit(); }
winform图标最小化显示在任务栏右下角
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。