请教高手:在VB里怎么实现界面全屏显示(全屏时控件的大小也随之改变)?
在VB里怎么实现界面全屏显示(当全屏时控件的大小也随之改变)
[解决办法]
给你个代码:我试过了,可以的,
Option Explicit
Dim ZiShiYing_T(), ZiShiYing_L(), ZiShiYing_H(), ZiShiYing_W(), ZiShiYing_N%
Private Sub Form_Load()
Dim mcontrol As Object
On Error Resume Next
ZiShiYing_N = 0
For Each mcontrol In Me.Controls
If Not (TypeOf mcontrol Is Menu) Then
ZiShiYing_N = ZiShiYing_N + 1
ReDim Preserve ZiShiYing_T(ZiShiYing_N)
ReDim Preserve ZiShiYing_L(ZiShiYing_N)
ReDim Preserve ZiShiYing_H(ZiShiYing_N)
ReDim Preserve ZiShiYing_W(ZiShiYing_N)
ZiShiYing_T(ZiShiYing_N) = mcontrol.Top / ScaleHeight
ZiShiYing_L(ZiShiYing_N) = mcontrol.Left / ScaleWidth
ZiShiYing_H(ZiShiYing_N) = mcontrol.Height / ScaleHeight
ZiShiYing_W(ZiShiYing_N) = mcontrol.Width / ScaleWidth
End If
Next
On Error GoTo 0
End Sub
Private Sub Form_Resize()
Dim mcontrol As Object
On Error Resume Next
ZiShiYing_N = 0
For Each mcontrol In Me.Controls
If Not (TypeOf mcontrol Is Menu) Then
ZiShiYing_N = ZiShiYing_N + 1
mcontrol.Top = ZiShiYing_T(ZiShiYing_N) * ScaleHeight
mcontrol.Left = ZiShiYing_L(ZiShiYing_N) * ScaleWidth
mcontrol.Height = ZiShiYing_H(ZiShiYing_N) * ScaleHeight
mcontrol.Width = ZiShiYing_W(ZiShiYing_N) * ScaleWidth
End If
Next
On Error GoTo 0
End Sub
窗体全屏显示,设置windowstat为2