autosize=True 然后当达到宽度时,把现实在标签的字符串换行即可。 例如:每行只显示4个字符:Option ExplicitPrivate Sub Form_Load() With Label1 .AutoSize = True .Caption = "中华人民" & Chr(13) & "共和国" End With End Sub
给你个小例子,自己去举一反三吧。Private Sub Form_Load() Label1.AutoSize = True Label1 = "1234567890123"End SubPrivate Sub Label1_Change() Static f As Boolean If f Then f = False: Exit Sub For i = 1 To Len(Label1) x = x & Mid(Label1, 5 * (i - 1) + 1, 5) & vbCrLf Next f = True Label1.Caption = xEnd Sub
然后当达到宽度时,把现实在标签的字符串换行即可。
例如:每行只显示4个字符:Option ExplicitPrivate Sub Form_Load()
With Label1
.AutoSize = True
.Caption = "中华人民" & Chr(13) & "共和国"
End With
End Sub
Label1.AutoSize = True
Label1 = "1234567890123"End SubPrivate Sub Label1_Change()
Static f As Boolean
If f Then f = False: Exit Sub
For i = 1 To Len(Label1)
x = x & Mid(Label1, 5 * (i - 1) + 1, 5) & vbCrLf
Next
f = True
Label1.Caption = xEnd Sub