Button newbutton=new Button();
int localy=0;
int localx=0 ;
newbutton.Location=new Point (localy,localx);
newbutton.Name ="wq";
this.Controls.Add(newbutton);
想把这段代码,先写进一个类里,之后,在窗体的构造函数里调用这个类,可是不行。
...全文
295打赏收藏
在窗体运行的时候,LOAD控件
想实现,在窗体运行的时候,增添控件,如何实现。 Button newbutton=new Button(); int localy=0; int localx=0 ; newbutton.Location=new Point (localy,localx); newbutton.Name ="wq"; this.Controls.Add(newbutton); 想把这段代码,先写进一个类里,之后,在窗体的构造函数里调用这个类,可是不行。
Button newbutton=new Button();
int localy=0;
int localx=0 ;
newbutton.Location=new Point (localy,localx);
newbutton.Name ="wq";
varForm.Controls.Add(newbutton);