还没想到更好的方法解决label的autosize的问题,只好写了下面的代码,一般在短的,符号不多的字符串中误差可以接受。。。没法子
Label1.Text = TextBox1.Text
For i = 1 To Label1.Text.Length
If Asc(Mid(TextBox1.Text, i, 1)) > 31 And Asc(Mid(TextBox1.Text, i, 1)) < 126 Then
cout = cout + 1
Else
cout = cout + 2
End If
Next
Label1.Width = 120 * cout
![](/Emoticons/emsad.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)