/// <summary> /// /// </summary> /// <param name="e"></param> /// <returns></returns> public static GUIMouseEventArgs Translate(this System.Windows.Forms.MouseEventArgs e) { var button = (GUIMouseButtons)e.Button; var args = new GUIMouseEventArgs(button, e.Clicks, e.X, e.Y, e.Delta); return(args); }
void CtrlButton_MouseUp(object sender, GUIMouseEventArgs e) { if (e.Button == GUIMouseButtons.Left) { this.Location = this.originalLocation; this.Size = this.originalSize; } }
void winCanvas_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { GUIMouseEventArgs args = e.Translate(); foreach (var item in this.Children) { item.InvokeEvent(EventType.MouseMove, args); } }
void winCanvas_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { GUIMouseEventArgs args = e.Translate(); if (this.mouseDownControl != null) { this.mouseDownControl.InvokeEvent(EventType.MouseUp, args); this.mouseDownControl = null; } }
void CtrlButton_MouseDown(object sender, GUIMouseEventArgs e) { if (e.Button == GUIMouseButtons.Left) { this.originalLocation = this.Location; this.originalSize = this.Size; this.Size = new GUISize((int)(this.Width * 0.9f), (int)(this.Height * 0.9f)); this.Location = new GUIPoint( (int)(this.Location.X + this.Width * 0.05f), (int)(this.Location.Y + this.Height * 0.05f)); } }
void winCanvas_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { GUIMouseEventArgs args = e.Translate(); foreach (var item in this.Children) { int x = e.X, y = this.BindingCanvas.Height - e.Y; if (item.ContainsPoint(x, y)) { this.mouseDownControl = item; item.InvokeEvent(EventType.MouseDown, args); } } }