哦,这个问题我以前也碰过。我写了个这样的模块。不知可有用?代码如下:
Public Sub ChangeSize(ByRef SetForm As Form)
Dim Cntl As Control
With SetForm
If Screen.Width = 15360 Then
Size = Screen.Width / 1024 / Screen.TwipsPerPixelX
ElseIf Screen.Width = 12000 Then
Size = Screen.Width / 800 / Screen.TwipsPerPixelX
ElseIf Screen.Width = 7200 Then
Size = Screen.Width / 640 / Screen.TwipsPerPixelX
End If
.Height = .Height * Size
.Width = .Width * Size
End With
For Each Cntl In SetForm
With Cntl
On Error Resume Next
.Height = .Height * Size
.Width = .Width * Size
.Font.Size = .Font.Size * Size
.Top = .Top * Size
.Left = .Left * Size
End With
Next Cntl
End Sub
Public Sub ChangeSize(ByRef SetForm As Form)
Dim Cntl As Control
With SetForm
If Screen.Width = 15360 Then
Size = Screen.Width / 1024 / Screen.TwipsPerPixelX
ElseIf Screen.Width = 12000 Then
Size = Screen.Width / 800 / Screen.TwipsPerPixelX
ElseIf Screen.Width = 7200 Then
Size = Screen.Width / 640 / Screen.TwipsPerPixelX
End If
.Height = .Height * Size
.Width = .Width * Size
End With
For Each Cntl In SetForm
With Cntl
On Error Resume Next
.Height = .Height * Size
.Width = .Width * Size
.Font.Size = .Font.Size * Size
.Top = .Top * Size
.Left = .Left * Size
End With
Next Cntl
End Sub
我的方法,假如你的开发环境是800*600(这个肯定只有一种情况)
size=screen.width/12000
就行了吗!
还有点不明白:
一个form中的各个控件,可以通过循环来控制,不大懂你的意思,主要是我接触vb不长,还有很多东西要学:)
另外,字体的大小,也可以 *size来实现 大小的改变吗?
我还没顾上试呢!一直的感觉是,不大可能,就没试!!!
见笑!!!!1
VB中的控件可以通过循环遍历控件集合得到没一个控件,然后size是在分别率不同下的象素的大小。
然后在每一个窗体的form_load事件中,写如下代码:
changsize me
就OK