怎么做网站赚,长沙网站外包,微商网站模板,企业建站系统cms程序添加托盘图标
UI层
//添加handycontrol的引用xmlns:hchttps://handyorg.github.io/handycontrol//添加NotifyIcon图标 实现单击 双击 二级菜单点击功能hc:NotifyIconText通知TokenInfohc:NotifyIcon.ContextMenuhttps://handyorg.github.io/handycontrol//添加NotifyIcon图标 实现单击 双击 二级菜单点击功能hc:NotifyIconText通知TokenInfohc:NotifyIcon.ContextMenuContextMenuMenuItem Commandhc:ControlCommands.PushMainWindow2Top HeaderOpen /MenuItem Commandhc:ControlCommands.ShutdownApp HeaderExit //ContextMenu/hc:NotifyIcon.ContextMenuhc:Interaction.Triggershc:EventTrigger EventNameClickhc:EventToCommand Commandhc:ControlCommands.PushMainWindow2Top//hc:EventTriggerhc:EventTrigger EventNameMouseDoubleClickhc:EventToCommand Commandhc:ControlCommands.PushMainWindow2Top//hc:EventTrigger/hc:Interaction.Triggers/hc:NotifyIcon
后台调用通过设置的Token值获取到NotifyIcon实例显示图标 private void SendNotification(){NotifyIcon.ShowBalloonTip(托盘图标测试, 托盘, NotifyIconInfoType.None,Info);}当窗口关闭时提示 //是否启用托盘图标显示功能private bool UseModetrue;protected override void OnClosing(CancelEventArgs e){if(UseMode){HandyControl.Controls.MessageBox.Info(Properties.Settings.Default.关闭软件提示, 提示);Hide();e.Cancel true;}else{base.OnClosing(e);}}Properties.Settings.Default.XXX :读取配置文件Settings.settings中的值 HandyControl.Controls.MessageBox.InfoHandyControl窗口提示信息