VB------WordWrap & Autosize
答案:1 悬赏:0 手机版
解决时间 2021-03-17 08:29
- 提问者网友:心牵心
- 2021-03-16 18:46
VB------WordWrap & Autosize
最佳答案
- 五星知识达人网友:污到你湿
- 2021-03-16 19:41
Autosize属性设置为TRUE之后,label的长度将随着你上面显示的文字自动调整大小。
WordWrap 属性示例
本例将文本放入两个 Label 控件并使用 WordWrap 属性来说明它们不同的行为。要试用此例,将下面的代码粘贴到包含两个 Label 控件的窗体的声明部分,然后按 F5 键 并单击窗体来转换 WordWrap 属性的设置值。
Private Sub Form_Load ()
Dim Author1, Author2, Quote1, Quote2
' 声明变量。
Label1.AutoSize = True
' 设置“自动调整大小”。
Label2.AutoSize = True
Label1.WordWrap = True
' 设置“自动换行”。
Quote1 = "I couldn't wait for success, so I went on without it."
Author1 = " - Jonathan Winters"
Quote2 = "Logic is a system whereby one may go wrong with confidence."
Author2 = " - Charles Kettering"
Label1.Caption = Quote1 & Chr(10) & Author1
Label2.Caption = Quote2 & Chr(10) & Author2
End Sub
Private Sub Form_Click ()
Label1.Width = 1440
' 将宽度设置为一英寸,以缇来表示。
Label2.Width = 1440
Label1.WordWrap = Not Label1.WordWrap ' 转换“自动换行”属性。
Label2.WordWrap = Not Label2.WordWrap
End Sub
WordWrap 属性示例
本例将文本放入两个 Label 控件并使用 WordWrap 属性来说明它们不同的行为。要试用此例,将下面的代码粘贴到包含两个 Label 控件的窗体的声明部分,然后按 F5 键 并单击窗体来转换 WordWrap 属性的设置值。
Private Sub Form_Load ()
Dim Author1, Author2, Quote1, Quote2
' 声明变量。
Label1.AutoSize = True
' 设置“自动调整大小”。
Label2.AutoSize = True
Label1.WordWrap = True
' 设置“自动换行”。
Quote1 = "I couldn't wait for success, so I went on without it."
Author1 = " - Jonathan Winters"
Quote2 = "Logic is a system whereby one may go wrong with confidence."
Author2 = " - Charles Kettering"
Label1.Caption = Quote1 & Chr(10) & Author1
Label2.Caption = Quote2 & Chr(10) & Author2
End Sub
Private Sub Form_Click ()
Label1.Width = 1440
' 将宽度设置为一英寸,以缇来表示。
Label2.Width = 1440
Label1.WordWrap = Not Label1.WordWrap ' 转换“自动换行”属性。
Label2.WordWrap = Not Label2.WordWrap
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯