zoukankan      html  css  js  c++  java
  • winform最小化及添加右键

            private void PrintService_SizeChanged(object sender, EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)
                {
                    this.Hide();
                    this.notifyIcon.Visible = true;
                }
            }
    
            private void PrintService_FormClosing(object sender, FormClosingEventArgs e)
            {
                if (MessageBox.Show("是否关闭服务", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                    e.Cancel = true;
            }
    
            private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    // 关闭所有的线程
                    this.Dispose();
                    this.Close();
                }
            }
    
            private void 显示ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)
                {
                    this.Show();
                    this.ShowInTaskbar = true;
                    this.WindowState = FormWindowState.Normal;
                    notifyIcon.Visible = false;
                }
            }

    参考:http://www.cnblogs.com/nangong/p/997995dc3743b60baac30899c3d82ef7.html

    http://www.cnblogs.com/_zjl/archive/2011/05/16/2047918.html             WinForm中实现最小化到系统托盘
    http://www.cnblogs.com/xugang/archive/2007/12/19/1006005.html      C#实现WinForm窗口最小化到系统托盘

  • 相关阅读:
    .NET中二进制图片的存储与读取
    mantis基本配置及邮件服务器配置
    搜狗浏览器特性页面JS
    从多个textarea中随机选取一个内容
    JS截取字符串substr 和 substring方法的区别
    MySQL递归的替代方案
    Eclipse去掉对JS文件的Validation
    Hadoop学习笔记二
    es随想二
    Hadoop学习笔记一
  • 原文地址:https://www.cnblogs.com/shy1766IT/p/5393899.html
Copyright © 2011-2022 走看看