예제 #1
0
 private void listBox1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         indexFirst       = -1;
         tournament       = -1;
         listBox1.Capture = true;
         int index = listBox1.IndexFromPoint(e.Location);
         if ((index >= 0) && (index < listBox1.Items.Count))
         {
             var     item = listBox1.Items[index];
             string  name = item.ToString();
             CPlayer pla  = FormChess.playerList.GetPlayer(name);
             indexFirst = index;
             tournament = pla.tournament > 0 ? 0 : 1;
             if (pla.SetTournament(tournament == 1))
             {
                 listBox1.Refresh();
                 if (player == pla)
                 {
                     SelectPlayer();
                 }
             }
         }
     }
 }
예제 #2
0
        void SaveToIni(CPlayer p)
        {
            p.name   = tbPlayerName.Text;
            p.engine = cbEngineList.Text;
            p.book   = cbBookList.Text;
            p.SetTournament((int)nudTournament.Value);
            p.elo             = nudElo.Value.ToString();
            p.eloOrg          = p.elo;
            p.modeValue.mode  = modeValue.mode;
            p.modeValue.value = modeValue.value;
            p.SaveToIni();
            UpdateListBox();
            int index = listBox1.FindString(p.name);

            if (index == -1)
            {
                return;
            }
            listBox1.SetSelected(index, true);
        }
예제 #3
0
        void SelectPlayers(int first, int last, bool t)
        {
            int  f = first < last ? first : last;
            int  l = first < last ? last : first;
            bool r = false;

            for (int n = f; n <= l; n++)
            {
                var     item = listBox1.Items[n];
                string  name = item.ToString();
                CPlayer pla  = FormChess.playerList.GetPlayer(name);
                if (pla.SetTournament(t))
                {
                    r = true;
                }
            }
            if (r)
            {
                listBox1.Refresh();
                SelectPlayer();
            }
        }