这个要用算的,方法是:
1.比例式:当窗口大小发生改变的事件时,先取得目前的长宽;再取得改变后的长宽.求出改变比例,给回本文框做对应调整.
Option Explicit
Dim lx, ly As Long
Private Sub Form_Load()
With Me
lx = .Width
ly = .Height
End With
End Sub
Private Sub Form_Resize()
With Text1
.Width = .Width * (Me.Width / lx)
.Height = .Height * (Me.Height / ly)
lx = Me.Width
ly = Me.Height
End With
End Sub
2.固定式:如果要固定对边缘的距离,就要先取好对应值.
Option Explicit
Dim lx, ly As Long
Private Sub Form_Load()
With Text1
lx = Me.Width - (.Left + .Width)
ly = Me.Height - (.Top + .Height)
End With
End Sub
Private Sub Form_Resize()
With Text1
.Width = Me.Width - (lx + .Left)
.Height = Me.Height - (ly + .Top)
End With
End Sub
温馨提示:答案为网友推荐,仅供参考