VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > Python基础教程 >
  • C#教程之菜单及右下角小图标的练习

  private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) //退出菜单方法
        {
            //this.Close();
            Application.Exit();//建议使用该关闭语句
        }

        private void timer1_Tick(object sender, EventArgs e) //时间方法
        {
            toolStripStatusLabel1.Text = DateTime.Now.ToString();
        }
        private void Form1_Resize(object sender, EventArgs e)//窗口最大最小改变后产生的效果
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                notifyIcon1.Visible = true;
                this.Visible = false;
            }
            else
            {
                notifyIcon1.Visible = false;
                this.Visible = true;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //if (this.WindowState == FormWindowState.Minimized)
            //{
            //    ShowInTaskbar = false;
            //}
        }

        //private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        //{
        //    this.Visible = true;
        //    this.WindowState = FormWindowState.Normal;
        //}
        private void notifyIcon1_DoubleClick(object sender, EventArgs e) //右下角小图标相关设定
        {
            this.Visible = true;
            this.WindowState = FormWindowState.Normal;
        }
        private void 显示ToolStripMenuItem_Click(object sender, EventArgs e) //双击右下角图标显示程序窗口
        {
            notifyIcon1_DoubleClick(sender, e);
        }
复制代码

 

路漫漫其修远兮 吾将上下而求索

相关教程