单击窗体在单击处插入控件 - asp.net 教程-
时间:2010-08-27 来源:星空3
private void Form1_MouseDown(object sender, MouseEventArgs e)
{ //设定他的名称和Button属性,以及产生的位置
Button bnt = new Button();
bnt.Left = e.X;
bnt.Top = e.Y;
bnt.Name = "Button" + intCount.ToString();
bnt.Text = "Button" + intCount.ToString();
this.Controls.Add(bnt);
intCount++;
}
相关阅读 更多 +