在 vb6 中热制作鼠标在图像上离开事件
我有一张图像,我在 MouseMove 中编写了代码来突出显示它。这是我想要的,当鼠标离开图像时,高光消失,但我似乎找不到任何可以做到这一点的事件。我正在使用 Visual Basic 6.0。我尝试过 mouseup 和 down 事件,但它们与我的要求不符。
谢谢
I have a image for which i have written code in MouseMove to higlight it. this is being done what i want is to when the mouse leaves image the highlights go away but i cant seem to find any event which will do that. i am working in visual basic 6.0. i have tried the mouseup and down event but they dont match my req.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
VB6 中没有类似的事件(尽管 VB.Net 有 鼠标离开)。您将需要在窗体(或许还有任何容器控件)的 MouseMove 事件中执行某些操作。
There isn't an event like that in VB6 (although VB.Net has MouseLeave). You will need to do something in the MouseMove event of the form (and perhaps any container controls too).
Marco Bellinaso 专门为此目的编写了一个很棒的小 ocx 控件,Marco Bellinaso 是一位受人尊敬的作者,也是当时 VB 社区优秀内容的重要贡献者。
该控件称为“MB MouseHelper”。您可以从 devx.com 下载它,网址为 http://www.devx.com/vb2themax/CodeDownload /19735。
替代文本 http://img25.imageshack.us/img25/3985/screencap20100809110523.jpg< /a>
使用 VB 内置的
MouseMove
事件使该控件变得有用,有两个问题:MouseMove
事件,从而取消突出显示图像There is a great little ocx control for this exact purpose written by Marco Bellinaso, a well respected author and a big contributor of good content to the VB community in his time.
The control is called the "MB MouseHelper". You can download it from devx.com at http://www.devx.com/vb2themax/CodeDownload/19735.
alt text http://img25.imageshack.us/img25/3985/screencap20100809110523.jpg
There are two problems with using VB's built in
MouseMove
event that make this control useful:MouseMove
event that unhighlights your image您还可以将要模拟 mouseleave 事件的图像放在更大的图片中。这样,当您离开内部图片(较小)时,您将触发外部图片的 mousemove 事件。此外,如果您使用框架或标签而不是另一张图片,这也有效
You can also put the image you want to simulate the mouseleave event inside a bigger picture. That way, when you leave the inner picture (smaller) you will hit the mousemove event of the outer picture. Also, this works if you use a frame or label instead of another picture
您始终可以对控件进行子类化。 这里有一篇文章介绍了如何执行此操作。
You can always subclass the control. Here's an article that describes how to do it.
如果您使用 mouseMove 事件,需要注意的一件事是,当您处于要突出显示的控件中时,要升起一个标志,而当您处于 OUT 时,要升起另一个标志,以免在每次鼠标 xy 更改时重复相同的操作
One thing to care about if you use the mouseMove event is to raise a flag when you are IN the control you want to highlight and raise another when you are OUT so as not to repeat the same action on each mouse xy change