Creating HotSpots in C#

前端 未结 4 468
南笙
南笙 2021-01-24 00:23

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

4条回答
  •  悲&欢浪女
    2021-01-24 01:14

    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.
    } 
    

提交回复
热议问题