在运行时设置字体大小 [英] setting font size at run time
本文介绍了在运行时设置字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在标签上放置一些文本并在运行时增加字体大小.
I would like to put some text on a label and increase the font size at runtime.
How can I do this?
推荐答案
对于WinForms,您需要使用新的size参数设置Label的字体"属性,而不是设置Size属性.直接地.在Winforms中,Size属性是只读的.
继承人的代码
For WinForms, you need to set the ''Font''property of the Label with new size parameters instead of setting the Size property directly. The Size property is read-only in Winforms.
Heres the code for it
float size = 100;
label1.Font = new Font(FontFamily.GenericSerif, size);
根据需要使用Font(....)重载
下次尝试更清楚地回答您的问题.欢呼!!!
Use the Font(....) overloads as per your requirement
Try to be more clear on your question next time. Cheers !!!
更改字体试试这个
Label.text =您的新文本"
Label.Font.Size = 14;
to change the font try this
Label.text="Your new text"
Label.Font.Size=14;
这篇关于在运行时设置字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文