Private Sub Command1_Click()
Text1.Text = GetMaxVisibleStr(Text1, Text2.Text)
Debug.Print Text1.Text
End Sub
Public Function GetMaxVisibleStr(TheText As TextBox, _
TheStr As String) As String
Dim i As Long
With Label1
.BorderStyle = TheText.BorderStyle
.Font = TheText.Font
For i = 1 To Len(TheStr)
.Caption = Left(TheStr, i)
If .Width > TheText.Width Then
GetMaxVisibleStr = Left(TheStr, i - 1)
Exit Function
End If
Next i
End With
例如 dim tt1 as string
dim n as integer (够用吗)
dim m as integer (够用吗)
n=?
tt1=left ( text1.text,n)
tt1写到一个。。。去
m=len (text1.text)-n
text1.text=right(text1.text , m)
再来,可写个循环
n=?
tt1=left ( text1.text,n)
。。。。。。
如此如此