Winforms:system.windows.forms.label文本显示为标签中的文本 [英] Winforms: system.windows.forms.label text displayed as text in label

查看:326
本文介绍了Winforms:system.windows.forms.label文本显示为标签中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的程序.功能之一是它计算点击次数,当程序完成时,将显示带有一些文本和点击次数的标签.该代码可以工作,但是问题是标签显示了额外的文本,如下所示: system.windows.forms.label文本

I have created a simple program. One of the functions is that it counts clicks, and when the program finishes, a label is displayed with some text and the number of clicks. The code works, but the problem is that the label displays extra text, like this: system.windows.forms.label text

Stevec设置为计算点击次数.标签konec已经包含文本,在这种情况下,我只想添加带有点击次数的额外句子.

Stevec is set to count clicks. Lable konec already contains text, and in this case I just want to add the extra sentence with the number of clicks.

konec.Text = konec + " Kliknil si: " + Stevec.ToString() + "-krat!";

如果有人对如何仅显示我在代码中设置的文本有任何想法,我将不胜感激!

If anyone has any idea how to display only the text that I have set in the code, I would appreciate it!

推荐答案

您需要 Text 属性而不是控件本身:

You need the Text property instead of the control itself:

konec.Text = konec.Text + " Kliknil si: " + Stevec.ToString() + "-krat!";

这篇关于Winforms:system.windows.forms.label文本显示为标签中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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