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

}

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 kinomelma 的頭像
    kinomelma

    基尼而絲(G.N.A.S)的大世界

    kinomelma 發表在 痞客邦 留言(1) 人氣()