vb.net or C#

 

//把控制项塞到阵列理
//RadioButton[] radios = new RadioButton[] { this.checkBox_1, this.checkBox_2,
// this.checkBox_3, this.checkBox_4,this.checkBox_5, this.checkBox_6,
//this.checkBox_7, this.checkBox_8,this.checkBox_9};


Control[] lbl = this.Controls.Find("checkBox_" + temp1, true);
Control[] lbl2 = this.Controls.Find("checkBox_" + temp2, true);
(lbl2[0] as CheckBox).Image = radioButton_temp.Image;
(lbl[0] as CheckBox).Image = radioButton_temp2.Image;

 


//取得checkBox
CheckBox radios = this.Controls.Find("checkBox_" + now_label_id, true).FirstOrDefault() as CheckBox;
//radioButton_temp.Image = (radios as CheckBox).Image;

//if ((radios as CheckBox).Checked){
//toolStripStatusLabel1.Text = "点选" + now_label_id;//状态列

 


private void get_id(object sender, EventArgs e)
{
int nid = 0;
Control ctrl = (Control)sender;
string[] splitText = ctrl.Name.Split("_".ToCharArray());
string now_label_id = splitText[1];//取出ID
nid = Convert.ToInt32(splitText[1]);//取出ID (转数字)
//MessageBox.Show("clcik: " + nid);
//string click_word = ctrl.Text; //按下的字母
toolStripStatusLabel1.Text = now_label_id;//状态列

}

 

以前的VB用法

for(i=1 to 5){

checkBox[i].text=i

}

 

相关文章