www.pudn.com > kaoshi.rar > TeacherForm.cs, change:2007-12-13,size:2692b


using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
 
namespace MySchool 
{ 
    /// <summary> 
    /// 教员登录后的主窗体 
    /// </summary>  
    public partial class TeacherForm : Form 
    { 
        public TeacherForm() 
        { 
            InitializeComponent(); 
        } 
 
        // 点击退出时,退出应用程序 
        private void tsmiExit_Click(object sender, EventArgs e) 
        { 
            // 弹出消息框向用户确认 
            DialogResult result = MessageBox.Show("确定要退出吗?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question); 
            
            // 如果选择了“是”,退出应用程序 
            if (result == DialogResult.Yes) 
            { 
                Application.Exit(); 
            }             
        } 
 
        // 点击时,打开新增试题窗体 
        private void tsmiAddQuestion_Click(object sender, EventArgs e) 
        { 
            // 创建窗体对象 
            AddQuestionForm addQuestionForm = new AddQuestionForm(); 
            // 设置 MDI 主窗体 
            addQuestionForm.MdiParent = this; 
             
            // 显示窗体 
            addQuestionForm.Show();   
        } 
 
        // 点击菜单中的“帮助”->”关于”,以模式窗口显示 About 窗体 
        private void tsmiAbout_Click(object sender, EventArgs e) 
        { 
            AboutForm aboutForm = new AboutForm(); 
            aboutForm.ShowDialog();  // 以模式窗口显示 
        } 
 
        // 窗体加载事件处理 
        private void TeacherForm_Load(object sender, EventArgs e) 
        { 
            // 设置状态栏标签显示的文字 
            lblTeacher.Text = string.Format("教员{0}登录了!",UserHelper.loginId); 
        } 
 
        // 显示查询试题窗体 
        private void tsmiSearchQuestion_Click(object sender, EventArgs e) 
        { 
            SearchQuestionForm searchForm = new SearchQuestionForm(); 
            searchForm.MdiParent = this; 
            searchForm.Show(); 
        } 
 
        // 显示试题列表窗体 
        private void tsmiQuestionList_Click(object sender, EventArgs e) 
        { 
            QuestionListForm questionListForm = new QuestionListForm(); 
            questionListForm.MdiParent = this; 
            questionListForm.Show(); 
        } 
 
        // 窗体关闭后,退出应用程序 
        private void TeacherForm_FormClosed(object sender, FormClosedEventArgs e) 
        { 
            Application.Exit(); 
        } 
    } 
}