产后盆底肌检查松弛:将程序最小化到系统托盘

来源:百度文库 编辑:偶看新闻 时间:2024/07/06 20:02:32
1.添加一个NotifyIcon控件2.绑定控件的单击和双击事件        ///
        /// 单击事件
        ///

        ///
        ///
        private void notifyIcon1_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            notifyIcon1.Visible = true;
            this.TopMost = false;
        }
        ///
        /// 双击事件
        ///

        ///
        ///
        private void notifyIcon1_DoubleClick(object sender, EventArgs e)
        {
            this.Visible = true;
            this.WindowState = FormWindowState.Normal;
            this.TopMost = true;
            notifyIcon1.Visible = true;
        }
        ///
        /// 重设大小
        ///

        ///
        protected override void OnResize(EventArgs e)
        {
            if (WindowState == FormWindowState.Maximized)
            {
                //最大化时所需的操作 ;
                this.Visible = true;
                notifyIcon1.Visible = true;
            }
            else if (this.WindowState == FormWindowState.Minimized)
            {
                //最小化时所需的操作
                this.Visible = false  ;
                notifyIcon1.Visible = true;
                this.TopMost = false;
            }
        }3.设置控件的Icon属性(任务栏显示的图标)和Text属性(鼠标放在拖盘上显示的文字提示)