void control_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { Console.WriteLine("mouse clicked"); if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (currentGesture == null){ currentGesture = new CaptureGesture(new System.Drawing.Point(e.X,e.Y),fullDirections); control.MouseMove += new System.Windows.Forms.MouseEventHandler(control_MouseMove); control.Cursor = System.Windows.Forms.Cursors.Cross; } else { currentGesture.StopCapturing(); control.MouseMove -= new System.Windows.Forms.MouseEventHandler(control_MouseMove); Console.WriteLine("Comparing gestures..."); foreach (Gesture g in _GesturesList) { if (currentGesture == g) { Console.WriteLine("Gesture found! action = {0}", g.Action); System.Windows.Forms.MessageBox.Show("Action = " + g.Action); break; } } currentGesture = null; control.Cursor = System.Windows.Forms.Cursors.Default; } } }
public Gestures(bool _fullDirections=true) { _GesturesList = new List<Gesture>(); currentGesture = null; fullDirections= _fullDirections; }