2013-04-29 6 views
0

저는 C#에서 beginginer이고 버튼을 만드는 버튼을 만들고 싶습니다.버튼을 생성하는 버튼을 만듭니다.

private void addstrat3_i_Click(object sender, EventArgs e) 
    { 
     panel3strat.Width += 200; 
     Button addstrat3_2 = new Button(); 
     addstrat3_2.Size = new Size(210, 41); 
     addstrat3_2.Location = new Point(50,50); 
     addstrat3_2.Visible = true; 
    } 

덕분에 당신은 Controls를 사용하여 폼에 버튼 (또는 다른 컨트롤)을 추가해야 할 많은

답변

10

: 하지만이 버튼은

내 코드를 찾아주세요 ... 나타나지 않습니다 속성의 경우 샘플 :

private void addstrat3_i_Click(object sender, EventArgs e) 
{ 
    panel3strat.Width += 200; 
    Button addstrat3_2 = new Button(); 
    addstrat3_2.Size = new Size(210, 41); 
    addstrat3_2.Location = new Point(50,50); 
    addstrat3_2.Visible = true; 

    // add control 
    this.Controls.Add(addstrat3_2);  
} 
+0

당신이 저를 때리는 것처럼 보입니다! –

+0

고맙습니다. * –

3

폼에 단추를 추가해야합니다.

this.Controls.Add(addstrat3_2); 
관련 문제