以下的原的問題,即:
「... 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。 –