//使用类文件:
System.Windows.Forms.NotifyIcon
System.Windows.Forms.ContextMenu
System.Windows.Forms.MenuItem
System.EventHandler
//实例:
//显示托盘图标
private void ShowNotifyIcon()
...{
//添加快捷菜单
ContextMenu cm = new ContextMenu();
MenuItem mi = new MenuItem("显示(&S)", new System.EventHandler(this.HideNotifyIcon));
cm.MenuItems.Add(mi);
notifyIcon1.ContextMenu = cm;
//显示托盘图标
notifyIcon1.Icon = this.Icon;
//隐藏窗口
this.Hide();
}
//隐藏托盘图标
private void HideNotifyIcon(object sender, EventArgs e)
...{
//藏托盘图标
notifyIcon1.Icon = null;
//显示窗口
this.Show();
}
1645

被折叠的 条评论
为什么被折叠?



