如何使鼠标悬停在vb.net图片框上的事件 [英] how can make mouse over event on picture box in vb.net

查看:190
本文介绍了如何使鼠标悬停在vb.net图片框上的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
如何使鼠标悬停在图片框上特定区域的事件上,我要做的是制作发光地图区域以制作地图指针
感谢

hi every body
how can make mouse over event on specific region on the picture box what i want to do is to make a glow map regions to make a map pointer
thanks

推荐答案

通过处理事件System.Windows.Forms.Control.MouseMove或覆盖虚拟方法System.Windows.Forms.Control.OnMouseMove,二者均由PictureBox(即System.Windows.Forms.Control)继承.请参阅:
http://msdn.microsoft.com/en-us/library/system. windows.forms.control.aspx [ ^ ].

但是,很可能您将滥用类PictureBox.仅在最简单的情况下才有用,当您只需要显示静态图片时,可能会偶尔更改它.如果您需要交互性,动画性或动态性的任何内容,则该类将给您带来更多麻烦,然后再提供帮助,只会占用资源,性能和开发时间,而没有提供任何有价值的回报.通过使用从System.Windows.Forms.Control派生的自定义控件并在OnPaint方法中渲染图形,可以轻松实现任何动态行为.我会讲解.

请查看我过去的答案:
如何从旧图纸中清除面板 [ ^ ],
在C#中绘制矩形 [ Paint是一种哪种好玩的方法? (DataGridViewImageCell.Paint(...)) [在mdi子表单之间画线 [在面板上捕获图形 [ Paint是一种哪种好玩的方法? (DataGridViewImageCell.Paint(...)) [
By handling the event System.Windows.Forms.Control.MouseMove or overriding the virtual method System.Windows.Forms.Control.OnMouseMove, both inherited by PictureBox, which is System.Windows.Forms.Control. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.aspx[^].

However, chances are, you are going to abuse the class PictureBox. It is only good in simplest case, when you just need to show a static picture, may be change it occasionally. If you need anything interactive, animated or just dynamic, this class presents more hassles then help, just eats up resources, performance and your development time offering nothing valuable in return. You would implement any dynamic behavior much easier by using a custom control derived from System.Windows.Forms.Control and rendering graphics in OnPaint method. I''ll explain how.

Please see my past answers:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^].

See also:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^].

—SA


这篇关于如何使鼠标悬停在vb.net图片框上的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆