摘要: 1.拖一个NotifyIcon,一个ContextMenuStrip控件到主窗体中2、设置notifyIcon1,一个contextMenuStrip1(如下图)Icon为托盘图标,Text托盘显示文字,ContextMenuStrip右键菜单(退出),设置退出单击事件3、添加主窗体关闭事件(FormClosing)4、事件代码 private void MyService_FormClosing(object sender, FormClosingEventArgs e) { // 注意判断关闭事件reason来源于窗体按钮,否则用菜单退出时... 阅读全文
posted @ 2013-11-27 15:01 yuejin 阅读(5763) 评论(0) 推荐(0) 编辑
摘要: #region 设置开机运行/// /// 设置开机运行/// /// 需要运行的程序.exe/// public static bool SetStartRun(string R_startPath){ if (!File.Exists(R_startPath)) return false; FileInfo fi = new FileInfo(R_startPath); string newName = fi.Name; RegistryKey Rkey = Registry.LocalMachine.OpenSubKey(@"SOFTWA... 阅读全文
posted @ 2013-11-27 14:42 yuejin 阅读(1011) 评论(0) 推荐(0) 编辑