コード例 #1
0
ファイル: Form1.cs プロジェクト: icegithub/csharp-exercise
 /// <summary>
 /// 刷新学生列表
 /// </summary>
 /// <param name="targetClass">目标班级对象</param>
 void refreshStudentList(Classroom targetClass)
 {
     listBoxStuList.Items.Clear();
     if (targetClass.StudentNum <= 0) ;
     else
     {
         int index;
         for (index = 1; targetClass.getStudent(index) != null; index++)
         {
                 listBoxStuList.Items.Add(targetClass.getStudent(index).NAME);
         }
     }
     if(targetClass.StudentNum<Classroom.maxNum)
         listBoxStuList.Items.Add("添加新学生");
 }
コード例 #2
0
        private void listBoxStuList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBoxStuList.SelectedItem.ToString() == "添加新学生")
            {
                checkBoxChangeable.Checked = true;
                buttonSearch.Text          = "添加";
                enableReadOnly(false);
                checkBoxChangeable.Visible = false;
                {
                    textBoxName.Text  = "";
                    textBoxNum.Text   = "";
                    textBoxClass.Text = classInUse.ClassName;

                    textBoxChinese.Text = "0";
                    textBoxMath.Text    = "0";
                    textBoxEnglish.Text = "0";
                    textBoxAverage.Text = "0";
                    textBoxTotal.Text   = "0";
                }
            }
            else
            {
                enableReadOnly(true);
                checkBoxChangeable.Checked = false;
                checkBoxChangeable.Visible = true;
                buttonSearch.Text          = "删除";
                int index;
                studentInUse = classInUse.getStudent(listBoxStuList.SelectedIndex + 1);
                index        = listBoxStuList.SelectedIndex;
                showStudentInfo(studentInUse);
                listBoxStuList.SelectedIndex = index;
            }
        }
コード例 #3
0
 /// <summary>
 /// 刷新学生列表
 /// </summary>
 /// <param name="targetClass">目标班级对象</param>
 void refreshStudentList(Classroom targetClass)
 {
     listBoxStuList.Items.Clear();
     if (targetClass.StudentNum <= 0)
     {
         ;
     }
     else
     {
         int index;
         for (index = 1; targetClass.getStudent(index) != null; index++)
         {
             listBoxStuList.Items.Add(targetClass.getStudent(index).NAME);
         }
     }
     if (targetClass.StudentNum < Classroom.maxNum)
     {
         listBoxStuList.Items.Add("添加新学生");
     }
 }