7,763
社区成员
发帖
与我相关
我的任务
分享
''这个代码不闪!!!
Option Explicit
Private mFrm(3) As Form1
Private Sub Command1_Click(Index As Integer)
If Index = CInt(Me.Tag) Then Exit Sub
With mFrm(Index)
.Move 0, 0, Me.Width, Me.Height
.WindowState = 2
.Show
End With
With mFrm(CLng(Me.Tag))
.WindowState = 0
.Hide
End With
Me.Tag = CStr(Index)
End Sub
Private Sub MDIForm_Activate()
With mFrm(0)
.Show
.WindowState = 2
Me.Tag = "0"
End With
End Sub
Private Sub MDIForm_Load()
Dim i As Integer
For i = 0 To 3
Set mFrm(i) = New Form1
mFrm(i).Lab.Caption = "Form1--" & i
Next
End Sub
测试窗体控件:1个MDIForm1、一个Form1(mdichild=true)、一个picturebox、command1(0~3)以控件数组的形式存在于picturebox中。Private Declare Function LockWindowUpdate Lib "user32.dll" (ByVal hwndLock As Long) As Long
LockWindowUpdate MDIForm1.hWnd
Form1.Show
Form1.ZOrder
LockWindowUpdate 0