8,735
社区成员
发帖
与我相关
我的任务
分享
public MainWindow()
{
InitializeComponent();
noti = new NotifyIcon();
noti.BalloonTipText = "这是wpf的托盘";
noti.Icon = Properties.Resources.PerfCenterCpl;
ContextMenuStrip cs =new ContextMenuStrip();
ToolStripMenuItem tsm =new ToolStripMenuItem();
tsm.Text = "测试";
tsm.Image = Properties.Resources.PerfCenterCpl.ToBitmap();
cs.Items.Add(tsm);
noti.ContextMenuStrip =cs;
noti.Visible = true;
}
NotifyIcon noti;
private void Window_StateChanged(object sender, EventArgs e)
{
this.Hide();
if (this.WindowState == WindowState.Minimized)
noti.ShowBalloonTip(2000);
}