Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X < 0 Or X > Picture1.Width Or Y < 0 And Y > Picture1.Height Then
ReleaseCapture
Debug.Print "out" '隐藏消息框
Else
SetCapture Picture1.hWnd
Debug.Print "IN" '显示消息框
End If
End Sub
我不用API这样行不行???
private sub picture1_mousemove(button as integer,x as singe,y as single,shift as integer)
if MessageFlag=0 then'没有打开消息框
if (0<x) and (x<picture1.width) and (0<y) and (y<picture1.height) then
'显示消息框
frmBalloon1.SetBalloon "系统提示", " 双击弹出消息窗口", Me.ScaleWidth - frmBalloon1.Width, Me.ScaleHeight - frmBalloon1.Height, , True
MessageFlag=1
end if
else
if not ((0<x) and (x<picture1.width) and (0<y) and (y<picture1.height)) then
HidefrmBalloon'隐藏消息框
end if
end if
option explicit
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
private sub picture1_mousemove(button as integer,x as singe,y as single,shift as integer)
dim setmouse as boolean
with picture1
setmouse=(0<x) and (x<.width) and (0<y) and (y<.height)
end with
if setmouse then
form2.visible=true
form2.lable1.caption="改变FORM2的样式,可以当消息框用"
setcapture picture1.hwnd
else
form2.visible=false
releascapture
end if
end sub