Hi There!
I need change the state of a checkboxbutton of a list of buttons.
I use the folowing code to create buttons:
for (z=1; z<=10; z++)
{
string booth = "boo" + (z+t).ToString();
CheckBox MiControl = new CheckBox();
MiControl.Name = boo;
MiControl.Appearance = System.Windows.Forms.Appearance.Button;
MiControl.BackColor = System.Drawing.Color.White;
MiControl.Cursor = System.Windows.Forms.Cursors.Hand;
MiControl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
MiControl.ForeColor = System.Drawing.Color.White;
MiControl.ImageIndex = 3;
MiControl.ImageList = this.IconesCabines;
MiControl.Location = new System.Drawing.Point(x, y);
MiControl.Size = new System.Drawing.Size(50, 43);
MiControl.CheckStateChanged += new
System.EventHandler(this.boo_change);
x = x + 56;
this.Painel.Controls.Add(MiControl);
}
private void boo_change(object sender, System.EventArgs e){
CheckBox rdb = (CheckBox) sender;
if (rdb.Checked)
{
rdb.ImageIndex = 1;
}
else{
rdb.ImageIndex = 3;
}
}
It's perfect...
But how can I change the properties of the checkbox like
private void button_click(object sender, System.EventArgs e){
boo5.ImageIndex = 2;
}
Tks!!