请问我在VB中怎样才能让文本框的大小随窗体大小改变?

2025-04-03 10:23:36
推荐回答(1个)
回答1:

Dim tx As Single, ty As Single

Private Sub Form_Load()
tx = Text1.Width / Me.Width
ty = Text1.Height / Me.Height
End Sub

Private Sub Form_Resize()
If Me.WindowState <> vbMinimized Then
Text1.Width = tx * Me.Width
Text1.Height = ty * Me.Height
End If
End Sub