C# 如何通过脚本更改工具转换
本文关键字:工具 转换 脚本 何通过 | 更新日期: 2023-09-27 18:32:47
我知道如何通过脚本添加文本框或按钮,但我不知道如何在创建新(例如)按钮后更改它的大小和位置。这是我按下按钮时用于创建文本框的代码:
private void button1_Click(object sender, EventArgs e)
{
TextBox txt = new TextBox();
txt.Text = "helloo";
Controls.Add(txt);
Label lbl = new Label();
lbl.Text = "I am a label";
Controls.Add(lbl);
}
您需要设置Size
和Location
属性,或者单个Top
、Left
、Width
或Height
属性。