vb.net 标签字体大小改变
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27890446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Label font size changing
提问by Delupara
So I am making a small game in visual basics and at one of the thing I need to do is change the label size following an If statement. Sadly, It seemed way more complicated than I expected... I tried the following but it is "Read only"
所以我正在制作一个视觉基础的小游戏,我需要做的一件事是在 If 语句之后更改标签大小。可悲的是,它似乎比我预期的要复杂......我尝试了以下但它是“只读”
If condition = false then
lbltmp.Font.Size = 12pts
end if
I also Tried the following based on my friends advise:
我还根据朋友的建议尝试了以下方法:
With lbltmp.font
.size = 12
end with
I found similar question but they were all in c#, Which I don't know how to code in yet
我发现了类似的问题,但它们都在 c# 中,我还不知道如何编码
回答by Maciej Los
You need to change font instead of its size ;) See this: LINQ Cookbook, Recipe 1: Change the font for all labels on a windows form (Kit George)
您需要更改字体而不是其大小;) 请参阅:LINQ Cookbook, Recipe 1: Change the font for all labels on a windows form (Kit George)
label.Font = New Font("Comic Sans MS", 12, _
FontStyle.Bold Or FontStyle.Underline)
回答by D J
You can use 'label.Fontsize = **' Or else we need to change everything including font style and family.
您可以使用 'label.Fontsize = **' 否则我们需要更改所有内容,包括字体样式和系列。
回答by RAF Hacker Tutorials
You have to write this code. This will change the whole property of label.
您必须编写此代码。这将改变标签的整个属性。
Yourlabel.Font = New Font("Font Name", 10, FontStyle.Regular)
回答by Arjun
You could actually change the size of it but you don't use code. Instead just go to the properties of whatever you're trying to change the font size of, and go to the font property. Click on the 3 dots (...) and a box will open. In that box, you can change the font and its size too. So you could change the size there!
您实际上可以更改它的大小,但您不使用代码。相反,只需转到您尝试更改字体大小的任何属性的属性,然后转到字体属性。单击 3 个点 (...),将打开一个框。在那个框中,您也可以更改字体及其大小。所以你可以在那里改变大小!
(by the way this is the first time I've given an explanation on a website.)
(顺便说一下,这是我第一次在网站上给出解释。)