Пример #1
0
 private void tsbAddStudent_Click(object sender, EventArgs e)
 {
     if (objFrmAddStudent == null)
     {
         objFrmAddStudent = new FrmAddStudent();
         objFrmAddStudent.Show();//show this windows
     }
     else
     {
         objFrmAddStudent.Activate();
         objFrmAddStudent.WindowState = FormWindowState.Normal;
     }
 }
Пример #2
0
 //怎样保证对象的唯一性
 private void tsmiAddStudent_Click(object sender, EventArgs e)
 {
     if (objFrmAddStudent == null)
     {
         objFrmAddStudent = new FrmAddStudent();
         objFrmAddStudent.Show();
     }
     else
     {
         objFrmAddStudent.Activate();//激活只能在最小化的时候起作用
         objFrmAddStudent.WindowState = FormWindowState.Normal;
     }
 }