MouseMove问题

shuichong 2005-02-04 02:56:00
我想实现的功能是这样的,鼠标移到图片控件Picture上时显示一个提示窗口,鼠标移开图片控件Picgure时提示窗口消失

那我怎样用Picture的MouseMove,使了总是不行


...全文
211 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
tmd007 2005-02-05
  • 打赏
  • 举报
回复
用API挺好

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
tmd007 2005-02-05
  • 打赏
  • 举报
回复
if not ((0<x) and (x<picture1.width) and (0<y) and (y<picture1.height)) then
HidefrmBalloon'隐藏消息框
end if

这句会不会执行呢?
shuichong 2005-02-04
  • 打赏
  • 举报
回复
我不用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

Exit Sub
pikachu8guan 2005-02-04
  • 打赏
  • 举报
回复
还是使用下API吧
badboy168 2005-02-04
  • 打赏
  • 举报
回复
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
shuichong 2005-02-04
  • 打赏
  • 举报
回复
越来越不懂了!!!!!

kmzs 2005-02-04
  • 打赏
  • 举报
回复
移动的太快就不行了,MouseMove不是连续触发的。。。
xshhui 2005-02-04
  • 打赏
  • 举报
回复
或者也可以利用mouseout这个api,写在picture中
xshhui 2005-02-04
  • 打赏
  • 举报
回复
在窗体的mousemove事件中写上提示窗口消失
在picture的mousemove事件中写上显示一个提示窗口,
shuichong 2005-02-04
  • 打赏
  • 举报
回复
下面是MouseMove的代码,那怎么知道是鼠标移到Pic上还是移开Pic????
Private Sub Pic_Mail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim WinRect As RECT
Dim WinPoint As POINTAPI
Dim BalloonXY As BalloonCoords

Call GetWindowRect(Pic_Mail.hWnd, WinRect)
BalloonXY.X = WinRect.Left * Screen.TwipsPerPixelX
BalloonXY.Y = WinRect.Bottom * Screen.TwipsPerPixelY

Dim frmBalloon1 As New frmTip

frmBalloon1.SetBalloon "系统提示", " 双击弹出消息窗口", Me.ScaleWidth - frmBalloon1.Width, Me.ScaleHeight - frmBalloon1.Height, , True

frmBalloon1.Show , Me
Me.SetFocus
end sub
palmkey 2005-02-04
  • 打赏
  • 举报
回复
pic.ToolTipText ="xxxx"
rickytwice 2005-02-04
  • 打赏
  • 举报
回复
有个什么属性来着?tiptooltext?? 忘记咯,就是这个功能啊。
mousemove事件促发也成啊。
贴出你的代码!

呵呵:)
viena 2005-02-04
  • 打赏
  • 举报
回复
怎么不行?

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧