protected override void OnMouseMoved(MouseMovedEventArgs args) { args.Handled = true; var scrpt = ConvertToScreenCoordinates(args.Position); if (captured == DragModes.Move) { if (!DockPanel.DragRectangle.Contains(scrpt.X - this.orgpt.X, scrpt.Y - this.orgpt.Y)) { ClrCapture(); DockItDragDrop.StartDrag(this.owner, scrpt); } base.Cursor = GetCursor(captured, scrpt); return; } else if (captured != DragModes.None) { Rectangle r = GetDragPos(args.Position); if (r.Width >= 0 && r.Height >= 0) { SetNewPos(r); } base.Cursor = GetCursor(captured, scrpt); return; } else { base.OnMouseMoved(args); } base.Cursor = GetCursor(HitTest(args.Position), args.Position); }
protected override void OnMouseMoved(MouseMovedEventArgs args) { args.Handled = true; if (captured) { if (!DockPanel.DragRectangle.Contains(args.X - this.orgpt.X, args.Y - orgpt.Y)) { ClrCapture(); var docs = this.titlebar.pane.Documents.ToArray(); DockItDragDrop.StartDrag(this.titlebar.pane, docs, ConvertToScreenCoordinates(args.Position)); return; } } // base.OnMouseMoved(args); }
protected override void OnMouseMoved(MouseMovedEventArgs args) { args.Handled = true; if (captured) { args.Handled = true; if (this.closebutton != null && this.CloseRectangle.Contains(this.dragpt)) { if (!this.CloseRectangle.Contains(args.X, args.Y)) { // pressed & outside this.closebutton.BackgroundColor = DockPanel.ButtonHighlightDim; } else { // pressed & inside this.closebutton.BackgroundColor = DockPanel.ButtonHighlight; } } else if (!DockPanel.DragRectangle.Contains(args.X - this.dragpt.X, args.Y - this.dragpt.Y)) { ClrCapture(); // start drag var pt = this.ConvertToScreenCoordinates(args.Position); DockItDragDrop.StartDrag(this.buttons.titlebar.pane, new IDockContent[] { this.doc }, pt); } return; } else { if (((this.doc as IDockCustomize)?.CanClose ?? true) && this.CloseRectangle.Contains(args.Position)) { if (closebutton == null) { this.closebutton = new Label("X") { Font = TitleBar.SmallFont, Visible = false, BackgroundColor = DockPanel.ButtonHighlight, }; this.closebutton.ButtonPressed += Closebutton_ButtonPressed; this.closebutton.MouseMoved += Closebutton_MouseMoved; this.closebutton.ButtonReleased += Closebutton_ButtonReleased; this.closebutton.MouseExited += Closebutton_MouseExited; this.buttons.AddChild(closebutton); var b = this.buttons.GetChildBounds(this); this.buttons.SetChildBounds(closebutton, new Rectangle(CloseRectangle.Location.X + b.Location.X, CloseRectangle.Location.Y + b.Location.Y, CloseRectangle.Width, CloseRectangle.Height)); this.closebutton.Visible = true; } args.Handled = true; } else { RemoveCloseButton(); } } if (!args.Handled) { base.OnMouseMoved(args); } }