建立在C#中热区 [英] Creating HotSpots in C#

查看:127
本文介绍了建立在C#中热区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

...是否有可能在C#中创建热点,这样,当鼠标在某一地区的事件被触发?

... Is it possible to create hot-spots in C# so that when the mouse is over a certain area an event gets triggered?

推荐答案

您的标准从对象公开的OnMouseMove事件。既然你没有那里的热点将是任何控件,您可以只处理该事件的坐标:

Your standard From object exposes a OnMouseMove event. Given that you don't have any controls where the hot spots will be, you could just handle the coordinates in that event:


protected override void OnMouseMove(MouseEventArgs mouseEvent) 
{ 
     string X = mouseEvent.X.ToString();
     string Y = mouseEvent.Y.ToString(); 

     //Add code here to match X & Y to your hot spot coordinates.
} 

这篇关于建立在C#中热区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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