7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Dim frmArray(20) As Form
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 4
Set frmArray(i) = New frmBFForm
SetParent frmArray(i).hWnd, Form1.hWnd
frmArray(i).lblNum.Caption = (i + 1)
frmArray(i).Show
Next i
End Sub
Private Sub Form_Resize()
Dim i As Integer
Dim dWidth As Double
dWidth = (Me.Width - 240) / 5
For i = 0 To 4
frmArray(i).Top = 0
frmArray(i).Width = dWidth
frmArray(i).Left = i * frmArray(i).Width
Next i
'
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim frm As Form
For Each frm In Forms
Unload frm
Next
End Sub
Private Sub Form_Resize()
Dim dTemp As Double
Dim dWidth As Double, dHeight As Double
Dim dPicRowHeight As Double
Dim i As Integer
dHeight = Me.Height
dWidth = Me.Width
lblNum.Top = 0
lblNum.Left = 10
lblNum.Width = dWidth - 20
shpCircle.Top = lblNum.Top + lblNum.Height + 10
If dWidth * 0.23 > dHeight * 0.23 Then
dTemp = dHeight * 0.23
Else
dTemp = dWidth * 0.23
End If
shpCircle.Width = dTemp
shpCircle.Height = dTemp
shpCircle.Left = (dWidth - shpCircle.Width) / 2
lblTip.Left = 10
lblTip.Width = dWidth - 20
lblTip.Top = shpCircle.Top + (shpCircle.Height - lblTip.Height) / 2
picRect.Left = 10
picRect.Width = dWidth - 20
picRect.Top = shpCircle.Top + shpCircle.Height + 20
picRect.Height = dHeight - picRect.Top - 30
dPicRowHeight = picRect.Height / 4
For i = 0 To 3
lblItem(i).Left = 10
lblItem(i).Width = picRect.Width - 20
lblItem(i).Top = i * dPicRowHeight + (dPicRowHeight - lblItem(i).Height) / 2
Next i
End Sub