protected override void Draw(Point location, Eto.Forms.MouseEventArgs e) { if (e.Buttons == MouseButtons.Primary) { var action = new Actions.Block.Fill(Handler); var rect = new Rectangle(location, new Size(this.Size, this.Size)); var attribs = action.Attributes = new FillAttributes { Rectangle = rect, Mode = Controls.FillMode.Character }; var inverted = e.Modifiers.HasFlag(Keys.Shift) ^ Inverted; attribs.Character = new Character((inverted) ? (Character)32 : CurrentCharacter); if (e.Modifiers.HasFlag(Keys.Alt) ^ ApplyColour) { attribs.Mode |= Controls.FillMode.Attribute; attribs.Attribute = Handler.DrawAttribute; } action.Execute(); var middle = (Size - 1) / 2; UpdateCursorPosition(new Point(location.X + middle, location.Y + middle), rect); } }
private void PictureBox_MouseUp(object sender, MouseEventArgs e) { if (e.Buttons != MouseButtons.Primary || control.Image == null) return; isDrawing = false; if (OnDrawn != null) OnDrawn(); }
public override void OnMouseUp(Eto.Forms.MouseEventArgs e) { var pt = Handler.ScreenToCharacter((Point)e.Location); switch (this.DrawMode) { case DrawMode.Normal: Handler.CursorPosition = pt; break; case DrawMode.Selecting: base.OnMouseUp(e); if (this.CurrentRectangle != null) { var rect = this.CurrentRectangle.Value; if (rect.Width == 1 && rect.Height == 1) { DrawMode = DrawMode.Normal; } } /* * Handler.CursorPosition = pt; * var reg = new Rectangle (this.SelectedRegion.Value.Location, pt); * this.SelectedRegion = reg; * if (reg.Width == 1 && reg.Height == 1) { * DrawMode = DrawMode.Normal; * }*/ break; } }
public override void OnMouseDown(Eto.Forms.MouseEventArgs e) { if (!SetColor(e)) { base.OnMouseDown(e); } }
void LogMouseEvent(object sender, string type, MouseEventArgs e) { if (!showParentEvents.Checked == true && sender == this) return; Log.Write(sender, "{0}, Location: {1}, Buttons: {2}, Modifiers: {3}, Delta: {4}", type, e.Location, e.Buttons, e.Modifiers, e.Delta); if (handleEvents.Checked == true) e.Handled = true; }
public override void OnMouseUp(Eto.Forms.MouseEventArgs e) { ApplyStyles(); var fill = RipCommands.Create <Commands.Fill>(Document); fill.Point = (Point)e.Location; fill.Border = Handler.Foreground; Handler.AddCommand(fill); Handler.FlushCommands(null); e.Handled = true; }
protected override void Draw(Point location, Eto.Forms.MouseEventArgs e) { if (e.Buttons == MouseButtons.Primary) { action.Attributes = new FillAttributes { Rectangle = new Rectangle(location, new Size(this.Size, this.Size)), Mode = GetFillMode(e.Modifiers), Attribute = Handler.DrawAttribute }; action.Execute(); var middle = (Size - 1) / 2; Handler.CursorPosition = new Point(location.X + middle, location.Y + middle); } }
bool SetColor(Eto.Forms.MouseEventArgs e) { switch (e.Buttons) { case MouseButtons.Primary: Handler.Foreground = this.BGI.GetPixel((Point)e.Location); e.Handled = true; return(true); case MouseButtons.Alternate: Handler.Background = this.BGI.GetPixel((Point)e.Location); e.Handled = true; return(true); } return(false); }
private void PictureBox_MouseMove(object sender, MouseEventArgs e) { if (!isDrawing || control.Image == null) return; var ptSecond = control.ToImageCoordinate(e.Location); rect = new RectangleF { X = Math.Min(ptFirst.X, ptSecond.X), Y = Math.Min(ptFirst.Y, ptSecond.Y), Width = Math.Abs(ptFirst.X - ptSecond.X), Height = Math.Abs(ptFirst.Y - ptSecond.Y) }; rect.Width = Math.Max(MIN_RECT_SIZE, rect.Width); rect.Height = Math.Max(MIN_RECT_SIZE, rect.Height); control.Invalidate(); }
public override void OnMouseUp(Eto.Forms.MouseEventArgs e) { switch (e.Buttons) { case MouseButtons.Primary: var updates = new List <Rectangle> (); RemoveDrawing(updates); CreateCommand(); this.currentPoint = null; this.Command.Point = (Point)e.Location; ApplyDrawing(updates); Handler.FlushCommands(updates); e.Handled = true; break; default: base.OnMouseUp(e); break; } }
public override void OnMouseMove(Eto.Forms.MouseEventArgs e) { Point pt = Handler.ScreenToCharacter((Point)e.Location); switch (this.DrawMode) { case DrawMode.Paste: Handler.CursorPosition = pt; break; case DrawMode.Selecting: base.OnMouseMove(e); /* * if (e.Buttons.HasFlag (MouseButtons.Primary)) { * Handler.CursorPosition = pt; * }*/ //this.SelectedRegion = new Rectangle(this.SelectedRegion.Location, pt); break; } }
public override void OnMouseDown(Eto.Forms.MouseEventArgs e) { switch (this.DrawMode) { case DrawMode.Paste: var command = new Actions.Block.Paste(this); command.Execute(); break; case DrawMode.Normal: case DrawMode.Selecting: base.OnMouseDown(e); DrawMode = DrawMode.Selecting; /* * Handler.CursorPosition = Handler.ScreenToCharacter (e.Location); * var bs = new Actions.Block.BlockSelect (this); * bs.Activate (); */ break; } }
bool SetColor(Eto.Forms.MouseEventArgs e) { var location = GetLocation((Point)e.Location); var newAttr = Handler.CurrentPage.Canvas[location].Attribute; var curAttr = Handler.DrawAttribute; switch (e.Buttons) { case MouseButtons.Primary: newAttr.Background = curAttr.Background; Handler.DrawAttribute = newAttr; e.Handled = true; return(true); case MouseButtons.Alternate: newAttr.Foreground = curAttr.Foreground; Handler.DrawAttribute = newAttr; e.Handled = true; return(true); } return(false); }
/// <summary> /// Raises the mouse wheel event. /// </summary> public void OnMouseWheel(Control widget, MouseEventArgs e) { widget.Platform.Invoke(() => widget.OnMouseWheel(e)); }
protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); var zoom = Math.Max(Zoom + e.Delta.Height, 1); if (Zoom != zoom) { Zoom = zoom; Invalidate(); } }
/// <summary> /// Raises the mouse double click event. /// </summary> public void OnMouseDoubleClick(Control widget, MouseEventArgs e) { widget.Platform.Invoke(() => widget.OnMouseDoubleClick(e)); }
void LogMouseEvent (object sender, string type, MouseEventArgs e) { Log.Write (sender, "{0}, Location: {1}, Buttons: {2}, Modifiers: {3}", type, e.Location, e.Buttons, e.Modifiers); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); _downPoint = null; }
private void PictureBox_MouseDown(object sender, MouseEventArgs e) { if (e.Buttons != MouseButtons.Primary || control.Image == null) return; isDrawing = true; Paths.Add(new Path(Pen.Clone(), control.ZoomFactor)); }
private void OnMouseDown(object sender, EMouseEventArgs mouseEventArgs) { OnMouseEvent(MouseEventType.Down, mouseEventArgs); }
private void OnMouseWheel(object sender, EMouseEventArgs mouseEventArgs) { OnMouseEvent(MouseEventType.Wheel, mouseEventArgs); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); SetLabels(); }
private void PictureBox_MouseDown(object sender, MouseEventArgs e) { if (e.Buttons != MouseButtons.Primary || control.Image == null) return; isDrawing = true; ptFirst = control.ToImageCoordinate(e.Location); rect.Location = ptFirst; //if user draws MIN_RECT_SIZE, add it to click location }
void HandleMouseDoubleClick (object sender, MouseEventArgs e) { if (CanJoin ()) Close (DialogResult.Ok); }
private void _treeView_MouseDoubleClick(object sender, MouseEventArgs e) { OpenSelectedTreeItem(); }
private void OnMouseMove(object sender, MouseEventArgs mouseEventArgs) { var location = mouseEventArgs.Location; random.AddPoint(location.X, location.Y); Progress = Math.Min(random.Entropy*100/TargetEntropy, 100); if (random.Entropy >= TargetEntropy) { SeedMeterial = random.CreateSeedMaterial(); Close(); } }
public override void OnMouseUp (MouseEventArgs e) { base.OnMouseUp (e); SetLabels (); }
/// <summary> /// Raises the mouse <see cref="MouseDoubleClick"/> event. /// </summary> /// <param name="e">Mouse event arguments</param> protected virtual void OnMouseDoubleClick(MouseEventArgs e) { Properties.TriggerEvent(MouseDoubleClickEvent, this, e); }
protected override void OnMouseWheel(MouseEventArgs e) { var shouldScroll = (e.Modifiers & ActionModifierKey) != Keys.None; if (shouldScroll) { var zoomCenter = new PointF(e.Location.X - imageBounds.X, e.Location.Y - imageBounds.Y); var zoomIn = e.Delta.Height > 0; updateImageBounds(ref imageBounds, image.Size, zoomIn, zoomCenter); if (imageBounds.Width < image.Width && imageBounds.Height < image.Height && !zoomIn) imageBounds = fitAndCenterImage(image.Size, this.ClientSize); } base.OnMouseWheel(e); if (shouldScroll) this.Invalidate(); }
/// <summary> /// Raises the <see cref="MouseWheel"/> event. /// </summary> /// <param name="e">Event arguments</param> protected virtual void OnMouseWheel(MouseEventArgs e) { Properties.TriggerEvent(MouseWheelEvent, this, e); }
private void PictureBox_MouseMove(object sender, MouseEventArgs e) { if (!isDrawing || control.Image == null) return; var currentPath = Paths.Last(); currentPath.Points.Add(control.ToImageCoordinate(e.Location)); control.Invalidate(); }
private void OnMouseMove(object sender, EMouseEventArgs mouseEventArgs) { OnMouseEvent(MouseEventType.Move, mouseEventArgs); }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (!e.Buttons.HasFlag(MouseButtons.Primary)) { _downPoint = null; } if (_downPoint != null) { var xDelta = (_downPoint.Point.X - e.Location.X); var yDelta = (_downPoint.Point.Y - e.Location.Y); var scale = Zoom * 96; var newLatitude = _downPoint.Coordinate.Latitude - yDelta / scale; var newLongitude = _downPoint.Coordinate.Longitude + xDelta / scale; Center = new GeoCoordinate(newLatitude, newLongitude); Invalidate(); } }
private void OnMouseUp(object sender, EMouseEventArgs mouseEventArgs) { OnMouseEvent(MouseEventType.Up, mouseEventArgs); }
protected override void OnMouseMove(MouseEventArgs e) { bool shouldTranslate = (e.Modifiers & ActionModifierKey) != Keys.None; if (shouldTranslate) { if (startDragLocation.IsZero) //on start drag { startDragLocation = e.Location; cursor = this.Cursor; Cursor = Cursors.Pointer; } //on drag imageBounds.X += e.Location.X - startDragLocation.X; imageBounds.Y += e.Location.Y - startDragLocation.Y; startDragLocation = e.Location; this.Invalidate(); } else //on end drag { startDragLocation = PointF.Empty; Cursor = cursor; } base.OnMouseMove(e); }
private void OnMouseEvent(MouseEventType eventType, EMouseEventArgs eArgs) { var currentTime = DateTime.Now; if (eventType == MouseEventType.Down) { canBeClick = true; lastDownTime = currentTime; } else if (eventType == MouseEventType.Up) { if (canBeDoubleClick && (currentTime - lastClickTime).TotalSeconds < 0.5f) { eventType = MouseEventType.DoubleClick; canBeDoubleClick = false; } else if (canBeClick && (currentTime - lastDownTime).TotalSeconds < 0.5f) { eventType = MouseEventType.Click; canBeDoubleClick = true; lastClickTime = currentTime; } } var wheelDelta = Round(eArgs.Delta.Height); wheelPosition += wheelDelta; var rawGlobalPos = GetCurrentRawGlobalPos(); var currGlobalPos = Round(rawGlobalPos); var delta = currGlobalPos - prevGlobalPosition; if (eventType == MouseEventType.Move) { if (delta == IntVector2.Zero) { return; } canBeClick = false; canBeDoubleClick = false; } var viewport = mainForm.RenderControl.GetViewport(rawGlobalPos); var relMousePosition = rawGlobalPos - new Vector2(viewport.Left, viewport.Top); var currState = new MouseState { Buttons = ToClarity(Mouse.Buttons), Position = Round(relMousePosition), NormalizedPosition = Normalize(relMousePosition), HmgnPosition = Hmgnize(relMousePosition), WheelPosition = wheelPosition }; var cArgs = new MouseEvent { ComplexEventType = eventType, EventButtons = ToClarity(eArgs.Buttons), State = currState, Delta = delta, WheelDelta = wheelDelta, KeyModifiers = ToClarity(eArgs.Modifiers), Viewport = viewport }; inputService.OnInputEvent(cArgs); prevGlobalPosition = currGlobalPos; }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (_currentGrip != null) { _currentGrip = null; Cursor = Cursors.Default; Invalidate(); e.Handled = true; } }
void HandleMouseMove(object sender, MouseEventArgs e) { location = e.Location; ((Control)sender).Invalidate(); e.Handled = true; }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (_currentGrip != null) { _currentGrip.Update?.Invoke((SizeF)(e.Location - _startDrag)); _startDrag = _currentGrip.Location().Center; return; } var bounds = SizeBounds; var outer = RectangleF.Inflate(bounds, GripPadding * 2); IsSizing = outer.Contains(e.Location) && !bounds.Contains(e.Location); var grip = GetGrip(e.Location); if (grip != _hoverGrip) { _hoverGrip = grip; ToolTip = grip?.ToolTip; Invalidate(); } Cursor = grip?.Cursor ?? Cursors.Default; Invalidate(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Buttons == MouseButtons.Primary) { _currentGrip = GetGrip(e.Location); if (_currentGrip != null) { _startDrag = e.Location; _currentGrip?.Start?.Invoke(); Cursor = _currentGrip?.Cursor ?? Cursors.Default; e.Handled = true; } } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); _downPoint = new MapPoint(e.Location, Center); }