4个回答
展开全部
给你个通用的,自己写的。适用于所有带Move方法的控件。
直接粘贴代码即可。
====================
Private Sub Form_Load()
For Each Control In Controls
Control.Tag = Join(Array(Control.Left, Control.Top, Control.Width, Control.Height))
Next
Tag = Join(Array(Width, Height))
End Sub
Private Sub Form_Resize()
Dim sF, sC
sF = Split(Tag)
For Each Control In Controls
sC = Split(Control.Tag)
Control.Move Width / sF(0) * sC(0), Height / sF(1) * sC(1), Width / sF(0) * sC(2), Height / sF(1) * sC(3)
Next
For Each Control In Controls
Control.Tag = Join(Array(Control.Left, Control.Top, Control.Width, Control.Height))
Next
Tag = Join(Array(Width, Height))
End Sub
直接粘贴代码即可。
====================
Private Sub Form_Load()
For Each Control In Controls
Control.Tag = Join(Array(Control.Left, Control.Top, Control.Width, Control.Height))
Next
Tag = Join(Array(Width, Height))
End Sub
Private Sub Form_Resize()
Dim sF, sC
sF = Split(Tag)
For Each Control In Controls
sC = Split(Control.Tag)
Control.Move Width / sF(0) * sC(0), Height / sF(1) * sC(1), Width / sF(0) * sC(2), Height / sF(1) * sC(3)
Next
For Each Control In Controls
Control.Tag = Join(Array(Control.Left, Control.Top, Control.Width, Control.Height))
Next
Tag = Join(Array(Width, Height))
End Sub
展开全部
假设你要改变的控件是text1则加入以下代码:
Private Sub Form_Resize()
Text1.Height = Me.Height
Text1.Width = Me.Width
End Sub
Private Sub Form_Resize()
Text1.Height = Me.Height
Text1.Width = Me.Width
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
上面的代码不行,这样text1就变样了,不信自己试试
下面这个我自己试过了,可以用!(里面只用一个text1控件测试,其他的也同样可以实现
Dim hs
Dim vs
Dim width1
Dim left1
Dim top1
Dim height1
Private Sub form_load()
hs = Form1.Height
vs = Form1.Width
With Text1
width1 = .Width
left1 = .left
top1 = .top
height1 = .Height
End With
End Sub
Private Sub form_resize()
With Text1
.Width = width1 * Form1.Width / vs
.top = top1 * Form1.Height / hs
.left = left1 * Form1.Width / vs
.Height = height1 * Form1.Height / hs
End With
End Sub
下面这个我自己试过了,可以用!(里面只用一个text1控件测试,其他的也同样可以实现
Dim hs
Dim vs
Dim width1
Dim left1
Dim top1
Dim height1
Private Sub form_load()
hs = Form1.Height
vs = Form1.Width
With Text1
width1 = .Width
left1 = .left
top1 = .top
height1 = .Height
End With
End Sub
Private Sub form_resize()
With Text1
.Width = width1 * Form1.Width / vs
.top = top1 * Form1.Height / hs
.left = left1 * Form1.Width / vs
.Height = height1 * Form1.Height / hs
End With
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询