用Print 方法在PictureBox 控件上显示文本,如何让其自动换行?

2024-11-16 08:59:18
推荐回答(4个)
回答1:

大概给你一个思路:
Dim AR As String, AR1() As String, B As Integer, A As Integer
AR = "" '你需要输出的文本
A = Len(AR)
If A / 20 = A \ 20 Then '需要换行的次数,每20个字符换一行
B = A \ 20
Else
B = A \ 20 + 1
End If
ReDim AR1(1 To B)
For I = 1 To B
AR1(I) = Right(Left(AR, I * 20), 20)
Next I
下面输出到PictureBox即可

回答2:

Private Sub Form_click()
Dim str1 As String, temp As String
Me.Show
temp = "本人在图形(PictureBox)控件上用Print 方法显示文本,但字数太多,如何让其自动换行?请高手不吝赐教"
For i = 1 To Len(temp)
str1 = str1 & Mid(temp, i, 1)
If Picture1.TextWidth(str1) + 200 >= Picture1.Width Then
Picture1.Print str1
str1 = ""
End If
Next
Picture1.Print str1
End Sub

回答3:

另外用一个print语句,每个print重起一行

回答4:

你怎么显示文字的?
那段代码看一下