如何动态插入标签? [英] How to insert a Label dynamically?

查看:74
本文介绍了如何动态插入标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何仅在单击鼠标时动态插入标签?第一次单击后-不执行任何操作.

我无法为其制定逻辑代码.

请帮忙.
Thanx.

How to insert a label dynamically at only the first click of mouse? After first click - do nothing.

I am unable to formulate a logic code for it.

Please help.
Thanx.

推荐答案

请同时定义您的UI标记,无论是WinForms还是ASP.NET?

如果是winforms

然后存储一个布尔全局字段.

Please define your UI tag also, Either WinForms or ASP.NET ?

If winforms

Then store one boolean global field.

bool ShouldCreate = true;



稍后onbuttonClick动态创建标签并将字段设置为false



later onbuttonClick create the label dynamically and set the field to false

if(ShouldCreate)
{
Lable lbl = new Lable();
//Add lable where you want
ShouldCreate = false;
}



希望我能正确理解你.

如果有帮助,请 投票 接受答案 .



Hope I understand you properly.

Please vote and Accept Answer if it Helped.


您好,

1.声明一个标记Globe变量并初始化为true.
2如果flag为true,则声明label的对象并添加到面板中并将其定位.
3.set标志为false且为false.

我没有写代码,因为首先您要尝试.
Hi,

1.Declare a flag a globe variable and initialize is true .
2 if flag is true then declare the object of label and add into your panel and position it.
3.set flag is false with false.

I haven''t written code because first you try.


这篇关于如何动态插入标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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