Exemplo n.º 1
0
 //添加考生
 public void AddCandidate(string zjbm, string xm)
 {
     if (StudentlistView.InvokeRequired)
     {
         StudentlistView.Invoke(new AddItemDelegate(AddCandidate), zjbm, xm);
     }
     else
     {
         ListViewItem Item = new ListViewItem();
         Item.SubItems[0].Text = StudentlistView.Items.Count.ToString();
         Item.SubItems.Add(xm);
         Item.SubItems.Add(zjbm);
         if ((StudentlistView.Items.Count % 2) == 0)
         {
             Item.BackColor = Color.White;
         }
         else
         {
             Item.BackColor             = Color.FromArgb(255, 214, 224, 236);
             Item.SubItems[1].BackColor = Color.FromArgb(255, 214, 224, 236);
             Item.SubItems[2].BackColor = Color.FromArgb(255, 214, 224, 236);
         }
         Item.ForeColor             = Color.FromArgb(255, 69, 98, 135);
         Item.SubItems[1].ForeColor = Color.FromArgb(255, 69, 98, 135);
         Item.SubItems[2].ForeColor = Color.FromArgb(255, 69, 98, 135);
         StudentlistView.Items.Add(Item);
     }
 }
Exemplo n.º 2
0
 //清空考生
 public void ClearCandidate()
 {
     if (StudentlistView.InvokeRequired)
     {
         StudentlistView.Invoke(new ClearItemDelegate(ClearCandidate));
     }
     else
     {
         StudentlistView.Items.Clear();
     }
 }
Exemplo n.º 3
0
 //删除考生
 public void DeleteCandidate(string zkzbm)
 {
     if (StudentlistView.InvokeRequired)
     {
         StudentlistView.Invoke(new DeleteItemDelegate(DeleteCandidate), zkzbm);
     }
     else
     {
         List <int> delitem = new List <int>();
         for (int i = 0; i < StudentlistView.Items.Count; i++)
         {
             if (StudentlistView.Items[i].SubItems[2].Text.Trim() == zkzbm)
             {
                 delitem.Add(i);
             }
         }
         for (int i = 0; i < delitem.Count; i++)
         {
             StudentlistView.Items[delitem[i]].Remove();
         }
     }
 }