コード例 #1
0
        void menuItemAbout_Click(object sender, EventArgs e)
        {
            about frm = new about();

            frm.ShowDialog();
        }
コード例 #2
0
        private void initial_popup_menu()
        {
            this.menuItemClose        = new System.Windows.Forms.MenuItem();
            this.menuItemClose.Index  = 0;
            this.menuItemClose.Text   = "退出(&X)";
            this.menuItemClose.Click += (sender, e) =>
            {
                this.Close();
            };

            menuItemAbout        = new System.Windows.Forms.MenuItem();
            menuItemAbout.Index  = 1;
            menuItemAbout.Text   = "关于(&A)";
            menuItemAbout.Click += (sender, e) =>
            {
                about frm = new about();
                frm.ShowDialog();
            };

            //menuItemSerialConfig = new System.Windows.Forms.MenuItem();
            //menuItemSerialConfig.Index = 2;
            //menuItemSerialConfig.Text = "串口设置(&C)";
            //menuItemSerialConfig.Click += (sender, e) =>
            //{
            //    frmSerialPortConfig frm = new frmSerialPortConfig();
            //    frm.ShowDialog();
            //};



            menuItemEquipmentConfig        = new System.Windows.Forms.MenuItem();
            menuItemEquipmentConfig.Index  = 3;
            menuItemEquipmentConfig.Text   = "教室设置(&E)";
            menuItemEquipmentConfig.Click += new EventHandler(menuItemEquipmentConfig_Click);

            //menuItemQuestionMng = new System.Windows.Forms.MenuItem();
            //menuItemQuestionMng.Index = 4;
            //menuItemQuestionMng.Text = "题目管理(&Q)";

            //menuItemAnalysis = new System.Windows.Forms.MenuItem();
            //menuItemAnalysis.Index = 5;
            //menuItemAnalysis.Text = "统计分析(&S)";

            menuItemStudentMng        = new System.Windows.Forms.MenuItem();
            menuItemStudentMng.Index  = 6;
            menuItemStudentMng.Text   = "学生管理(&T)";
            menuItemStudentMng.Click += new EventHandler(menuItemStudentMng_Click);



            this.notifyContextMenu = new System.Windows.Forms.ContextMenu();
            this.notifyContextMenu.MenuItems.Add(menuItemStudentMng);
            //this.notifyContextMenu.MenuItems.Add(menuItemAnalysis);
            //this.notifyContextMenu.MenuItems.Add(menuItemQuestionMng);
            this.notifyContextMenu.MenuItems.Add(menuItemEquipmentConfig);
            //this.notifyContextMenu.MenuItems.Add(menuItemSerialConfig);
            this.notifyContextMenu.MenuItems.Add(menuItemAbout);
            this.notifyContextMenu.MenuItems.Add(menuItemClose);

            this.components = new System.ComponentModel.Container();

            // Create the NotifyIcon.
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);

            // The Icon property sets the icon that will appear
            // in the systray for this application.
            notifyIcon1.Icon = new Icon("5.ico");

            // The ContextMenu property sets the menu that will
            // appear when the systray icon is right clicked.
            notifyIcon1.ContextMenu = this.notifyContextMenu;

            // The Text property sets the text that will be displayed,
            // in a tooltip, when the mouse hovers over the systray icon.
            notifyIcon1.Text    = "智能教学互动系统";
            notifyIcon1.Visible = true;

            notifyIcon1.BalloonTipTitle = "智能教学互动系统已经启动";
            notifyIcon1.BalloonTipText  = "更多功能请点击...";
            notifyIcon1.ShowBalloonTip(5);
        }