예제 #1
0
        private void target_cmbBox_DrawItem_1(object sender, DrawItemEventArgs e)
        {
            Font myFont = new Font("Aerial", 10, FontStyle.Regular);

            if (this.target_cmbBox.SelectedIndex >= 0)
            {
                if (type == 0)
                {
                    ComboboxItemPlayer cp = (ComboboxItemPlayer)this.target_cmbBox.Items[this.target_cmbBox.SelectedIndex];
                    Player             p  = (Player)cp.value;
                    if (p.HMProtected)
                    {
                        e.Graphics.DrawString(target_cmbBox.Items[e.Index].ToString(), myFont, Brushes.LightGray, e.Bounds);
                    }
                    else
                    {
                        e.DrawBackground();
                        e.Graphics.DrawString(target_cmbBox.Items[e.Index].ToString(), myFont, Brushes.Black, e.Bounds);
                        e.DrawFocusRectangle();
                    }
                }
                else
                {
                    e.DrawBackground();
                    e.Graphics.DrawString(target_cmbBox.Items[e.Index].ToString(), myFont, Brushes.Black, e.Bounds);
                    e.DrawFocusRectangle();
                }
            }
        }
예제 #2
0
 private void target_cmbBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (type == 0)
     {
         if (this.target_cmbBox.SelectedIndex >= 0)
         {
             ComboboxItemPlayer cp = (ComboboxItemPlayer)this.target_cmbBox.Items[this.target_cmbBox.SelectedIndex];
             Player             p  = (Player)cp.value;
             if (p.HMProtected)
             {
                 this.target_cmbBox.SelectedIndex = -1;
             }
         }
     }
 }
예제 #3
0
        //combobox constructor for player choice
        public comboBoxDialog(List <Player> values, int type)
        {
            InitializeComponent();

            this.type = type;

            foreach (Player p in values)
            {
                ComboboxItemPlayer i = new ComboboxItemPlayer();
                i.name  = p.name;
                i.value = p;
                this.target_cmbBox.Items.Add(i);
            }
            this.Text = "Choose a player !";

            //default value for combobox
            this.target_cmbBox.SelectedIndex = 0;
        }
예제 #4
0
        private void validateButtonTarget_btn_Click(object sender, EventArgs e)
        {
            if (type == 0)
            {
                ComboboxItemPlayer p = (ComboboxItemPlayer)this.target_cmbBox.SelectedItem;
                this.target = (Player)p.value;
            }
            else if (type == 1)
            {
                ComboboxItemCardType ct = (ComboboxItemCardType)this.target_cmbBox.SelectedItem;
                this.cardType = (int)ct.value;
            }
            else if (type == 2)
            {
                ComboboxItemCard c = (ComboboxItemCard)this.target_cmbBox.SelectedItem;
                this.card = (Card)c.value;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }