C# 托盘图标. notifyIcon 用法

来源:互联网 发布:越南窄轨铁路知乎 编辑:程序博客网 时间:2024/05/29 03:35
           // ***************************************************************************************                //Application.Exit();                this.Hide();                notifyIcon1.Visible = true;                notifyIcon1.Text = "提醒程序";            // ***************************************************************************************    //---------------------对着图标双击事件----------------------------------------------        private void notifyIcon1_DoubleClick(object sender, EventArgs e)        {            this.Show();            this.WindowState = FormWindowState.Maximized;        }    private void F_Main_FormClosing(object sender, FormClosingEventArgs e)        {            if (!isExit)            {                e.Cancel = true;                this.Hide();                this.notifyIcon1.Visible = true;                this.notifyIcon1.ShowBalloonTip(3000, "提示", "系统仍在运行",ToolTipIcon.Info);             }        }------------------------------右键菜单的制作方法-------------------------------------------------------------------------notifyIcon1 属性ContextMenuStrip 绑定 contextMenuStrip1 private void Contex_exitApp_Click(object sender, EventArgs e) {            // ***************************************************************************************            string message = "你确定退出本程序?";            string caption = "提示信息";            MessageBoxIcon msgBoxIcon = MessageBoxIcon.Information;            MessageBoxButtons msgBtn = MessageBoxButtons.OKCancel;            DialogResult result = MessageBox.Show(message, caption, msgBtn, msgBoxIcon);            if (result == System.Windows.Forms.DialogResult.OK)            {                isExit = true;                Application.Exit();            }            // *************************************************************************************** }


原创粉丝点击