[英]How do I make a Output Label on Visual Studio C#
I am new at using Visual Studio as well as C#. 我是使用Visual Studio和C#的新手。 I'm having a hard time trying to figure out how to make a output label. 我很难弄清楚如何制作输出标签。 Does anyone know how to do this? 有谁知道如何做到这一点?
What I've currently been doing is dragging the label control to the text box. 我目前正在做的是将标签控件拖到文本框中。 Then, I would delete the text from the label but then it looks like it disappeared . 然后,我将从标签中删除文本,但是看起来好像消失了。
I think, this is what you want, 我想这就是你想要的
System.Windows.Forms.Label label1 = new System.Windows.Forms.Label();
label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
label1.Location = new System.Drawing.Point(34, 49);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(85, 23);
label1.TabIndex = 0;
label1.Text = "label1";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
first of all: this is broad question! 首先:这是一个广泛的问题! I'll just answer according to my understanding. 我会根据我的理解回答。
Define the AutoSize
of your label
to False
, then you can erase its text ( label1.Text = String.Empty
) without the label being seen as if it disappeared 将label
的AutoSize
定义为False
,然后可以擦除其文本( label1.Text = String.Empty
),而不会看到标签消失了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.