public static void DoEvent(MyMouseEvent me, int WheelDelta = 0) { int X = Cursor.Position.X, Y = Cursor.Position.Y; if (me.Event == MyMouseEvent.MouseEvent.Click) { me.Event = MyMouseEvent.MouseEvent.Down; mouse_event((int)me.ToInternalMouseEvent().Value, X, Y, WheelDelta, 0); me.Event = MyMouseEvent.MouseEvent.Up; mouse_event((int)me.ToInternalMouseEvent().Value, X, Y, WheelDelta, 0); } else { MouseEventInternal? i = me.ToInternalMouseEvent(); if (i != null) mouse_event((int)i.Value, X, Y, WheelDelta, 0); } }
/// <summary> /// Permette di lanciare un evento del mouse in una determinata cordinata /// </summary> /// <param name="me">Evento</param> /// <param name="X">Cordinata X</param> /// <param name="Y">Cordinata Y</param> /// <param name="BackOldPosition">True - alla fine, re-imposta le cordinate del mouse prima del click</param> /// <param name="WheelDelta">Se l'evento riguarda la wheel impostare il delta dello spostamento, altrimenti lasciare 0</param> public static void DoEvent(MyMouseEvent me, int X, int Y,bool BackOldPosition = true,int WheelDelta=0) { Point OldP = Cursor.Position; if (me.Event==MyMouseEvent.MouseEvent.Click) { me.Event = MyMouseEvent.MouseEvent.Down; mouse_event((int)me.ToInternalMouseEvent().Value, X, Y, WheelDelta, 0); me.Event = MyMouseEvent.MouseEvent.Up; mouse_event((int)me.ToInternalMouseEvent().Value, X, Y, WheelDelta, 0); } else { MouseEventInternal? i = me.ToInternalMouseEvent(); if (i != null) mouse_event((int)i.Value, X, Y, WheelDelta, 0); } if (BackOldPosition) Cursor.Position = OldP; }