WinForm上一个bottom1,点击就在窗体上生成一个textbox1控件和一个bottom2控件怎么做?
再在textbox1中输入文字点击bottom2句把输入的文字设置为窗体的标题。注:不能使用Visible属性...
再在textbox1中输入文字点击bottom2句把输入的文字设置为窗体的标题。注:不能使用Visible属性
展开
2个回答
展开全部
C#
public partial class Form1 : Form {
private Button buttton2; private TextBox textbox1;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.buttton2 == null)
{
this.buttton2 = new Button();
this.buttton2.Click += new EventHandler(button2_Click);
}
this.buttton2.Text = "Button2";
this.buttton2.Top = 100;
this.buttton2.Left = 150;
this.Controls.Add(this.buttton2);
if (this.textbox1 == null)
{
this.textbox1 = new TextBox();
}
this.textbox1.Top = 120 + this.buttton2.Height;
this.textbox1.Left = 150;
this.Controls.Add(this.textbox1);
}
void button2_Click(object sender, EventArgs e)
{
this.Text = this.textbox1.Text;
}
}
public partial class Form1 : Form {
private Button buttton2; private TextBox textbox1;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.buttton2 == null)
{
this.buttton2 = new Button();
this.buttton2.Click += new EventHandler(button2_Click);
}
this.buttton2.Text = "Button2";
this.buttton2.Top = 100;
this.buttton2.Left = 150;
this.Controls.Add(this.buttton2);
if (this.textbox1 == null)
{
this.textbox1 = new TextBox();
}
this.textbox1.Top = 120 + this.buttton2.Height;
this.textbox1.Left = 150;
this.Controls.Add(this.textbox1);
}
void button2_Click(object sender, EventArgs e)
{
this.Text = this.textbox1.Text;
}
}
追问
再在textbox1中输入文字点击bottom2句把输入的文字设置为窗体的标题。注:不能使用Visible属性
追答
已经修改答案,注意查看
威孚半导体技术
2024-08-19 广告
2024-08-19 广告
威孚(苏州)半导体技术有限公司是一家专注生产、研发、销售晶圆传输设备整机模块(EFEM/SORTER)及核心零部件的高科技半导体公司。公司核心团队均拥有多年半导体行业从业经验,其中技术团队成员博士、硕士学历占比80%以上,依托丰富的软件底层...
点击进入详情页
本回答由威孚半导体技术提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询