vb.net 如何制作标签多行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38656042/
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
How can I make a label multiline?
提问by Pirate
I have a Label
that has a large amount of text. The value comes from a database. What I want is to view that text in a multiline Label
but if the text is more than the width of the Label
it cuts down.
我有一个Label
有大量文本的。该值来自数据库。我想要的是在多行中查看该文本,Label
但如果文本大于它的宽度,则Label
它会减少。
Like:
喜欢:
----------------------------------
|This is a label and I want it to|
----------------------------------
But I want this:
但我想要这个:
-----------------------------------------------
|This is a label and I want it to be multiline|
|when needed. |
-----------------------------------------------
回答by
Follow these steps,
按着这些次序,
Go to properties of the label and set AutoSize : false
转到标签的属性并设置 AutoSize : false
Now expend your label to max size of the content like.
现在将您的标签扩展到内容的最大大小。
--------------------------------------------------
| |
| |
--------------------------------------------------
Now your text will not be go outside of the label and automatically go to next line when reach the end of the label.
现在您的文本将不会超出标签并在到达标签末尾时自动转到下一行。
回答by BABU VELUKUNNEL
You can display the required message in multiline on a lable.
您可以在标签上以多行形式显示所需的消息。
To accomplish this you have to assign the required data into a variable in multiline.
为此,您必须将所需的数据分配到多行变量中。
Use the following codes to accomplish this:
使用以下代码来完成此操作:
variable += variable + vbCrLf
variable += variable + vbCrLf
This will help you assign the variable in multiline
这将帮助您在多行中分配变量
label1.text = variable '
This will help to serve your purpose
这将有助于达到您的目的