在按钮上单击创建标签 [英] Build a Label on Button click

查看:99
本文介绍了在按钮上单击创建标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



每次单击按钮时,我都想构建一个新的Label.

Hi,

Every time I click on a Button, I want to build a new Label.

推荐答案

处理ButtonClick 事件,并在处理程序中,创建一个新的Label控件并将其添加到您的表单中.
Handle the Button''s Click event, and in the handler, create a new Label control and add it to your form.


在button的click事件中复制以下代码.
下次不要忘记更改按钮的位置...

Copy following code in the click event of button.
Don''t forget to change the Location of button, next time...

private void button1_Click(object sender, EventArgs e)
{
  System.Windows.Forms.Label lbl = new Label();
  lbl.Text = "Paras"
  lbl.Location = new System.Drawing.Point(0, 0);
  lbl.BackColor = System.Drawing.Color.Orange;
  this.Controls.Add(lbl);
}


:laugh::-O


:laugh: :-O


这篇关于在按钮上单击创建标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆