以下的原的问题,即:
“... I宁愿让用户选择最适合的文字,量尺寸的大小和字体“
你可以把下面的代码在用户窗体代码窗格:
Option Explicit
Private mouseLeft As Single, mouseTop As Single
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) '<~~ change "TextBox1" to whatever the actual name of your textbox
If Button = 1 Then
mouseLeft = X
mouseTop = Y
End If
End Sub
Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) '<~~ change "TextBox1" to whatever the actual name of your textbox
If Button = 1 Then
With Me.TextBox1 '<~~ change "TextBox1" to whatever the actual name of your textbox
.Width = .Width + X - mouseLeft
.Height = .Height + Y - mouseTop
End With
mouseLeft = X
mouseTop = Y
End If
End Sub
和用户可以将文本框边框拖动到所需的大小
如果不固定文本框的边缘并调整放置框的*表格的大小,那么您不能拥有该功能.VBA控件不是Web UI控件。 –
表单可调整大小。你的意思是我只能通过调整整个表单的大小来调整文本框的大小? –
是的。就我所知,无论如何都是通过用户拖放操作实现的。你可以在某个地方有一个+/-按钮来以编程方式增加/减少文本框的高度,但这很快就会不可避免地变成布局噩梦IMO。 –