MDIFORM 最小化到托盘 出现的怪问题?????求解(在此之前我不信心世间有鬼,可是现在~~~~~)
MDIFORM中没有加入toolbar,程序调试时可以最小化到托盘 可以恢复,make成可执行程序后也可以最小化到托盘 可以恢复MDIFORM中加入toolbar后,程序调试时可以最小化到托盘 可以恢复(即可以响应MDIForm_MouseMove事件)
make成可执行程序后可以最小化到托盘 但不能恢复(即不响应MDIForm_MouseMove事件)
Private Sub MDIForm_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Remember..... The value of X will be different if the icon is minimised
' to the system tray. The values in this case will be as follows,
' 7680 ' MouseMove
' 7695 ' Left MouseDown
' 7710 ' Left MouseUp
' 7725 ' Left DoubleClick
' 7740 ' Right MouseDown
' 7755 ' Right MouseUp
' 7770 ' Right DoubleClick
If myTrayIcon.bRunningInTray Then
Select Case Int(X / Screen.TwipsPerPixelX)
Case 514:
Call ShowWindow(Me.hWnd, SW_SHOWDEFAULT)
Call SetForegroundWindow(Me.hWnd)
Call myTrayIcon.ChangeToolTip(Me, "max window")
Call myTrayIcon.ChangeIcon(Me, Me.imgLstTitle.ListImages(1))
MinFlag = False
Case 517:
Call SetForegroundWindow(Me.hWnd)
PopupMenu Me.mainMenu
End Select
End If
End Sub
Private Sub MDIForm_Resize()
If IsIconic(Me.hWnd) <> 0 And MinFlag = False Then
MinFlag = True
Call ShowWindow(Me.hWnd, SW_HIDE)
Call myTrayIcon.ChangeIcon(Me, Me.imgLstTitle.ListImages(2))
Call myTrayIcon.ChangeToolTip(Me, "min window")
End If
End Sub --------------------编程问答-------------------- MDIForm_MouseMove注释如下:
' Remember..... The value of X will be different if the icon is minimised
' to the system tray. The values in this case will be as follows,
' -------------------------------------------
' MDIFORM FORM
' 512 7680 ' MouseMove
' 7695 ' Left MouseDown
' 514 7710 ' Left MouseUp
' 7725 ' Left DoubleClick
' 7740 ' Right MouseDown
' 517 7755 ' Right MouseUp
' 7770 ' Right DoubleClick
' --------------------------------------------- --------------------编程问答-------------------- because MDI form hasn't ScaleMode property so you should convert X value in MDIForm_MouseMove sub to pixel
your MDIForm_MouseMove should look like this
all your code lines didn't changed except this one
X = Int(X / Screen.TwipsPerPixelX)
这是我从老外的网上得到的解释,可是也不顶事啊!!!!
郁闷,求高手指教~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --------------------编程问答-------------------- 自己顶
补充:VB , 基础类