• 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窗口最小化到系统托盘

  • 相关阅读:
    Java Web入门二
    Java web入门之Http请求和响应
    Java中的heap和stack
    JSP和Servlet的区别和联系
    MVC设计思想
    Java中int和Integer的区别
    Java使用文件通道复制文件
    Maven项目的pom.xml配置文件格式初识
    面向对象编程思想
    1.struts 防止表单重复提交 2. 拦截器
  • 原文地址:https://www.cnblogs.com/shy1766IT/p/5393899.html
Copyright © 2020-2023  润新知