//===================================================================== public DockingControlDragger(DockingControl DockingControl, DockStyle ds) { this.Cursor = Cursors.Hand; this._DockingControl = DockingControl; this.Dock = DockingControl.HandleStyleFromControlStyle(ds); SizeToOrientation(ds); return; }
//===================================================================== protected override void OnMouseMove(MouseEventArgs e) { DockingControl docking_control = (DockingControl)this.Parent; if (docking_control.IsHidden) { this.Cursor = Cursors.Default; base.OnMouseMove(e); return; } // Cursor depends on if we a vertical or horizontal resize if ((this.Dock == DockStyle.Top) || (this.Dock == DockStyle.Bottom)) { this.Cursor = Cursors.HSplit; } else if ((this.Dock == DockStyle.Left) || (this.Dock == DockStyle.Right)) { this.Cursor = Cursors.VSplit; } // Can only resize if we have captured the mouse if (this.Capture) { // Find the new mouse position Point point = PointToScreen(new Point(e.X, e.Y)); // Have we actually moved the mouse? if (point != this._PointLast) { // Update the last processed mouse position this._PointLast = point; // Find delta from original position int xDelta = this._PointLast.X - this._PointStart.X; int yDelta = this._PointLast.Y - this._PointStart.Y; // Resizing from bottom or right of form means inverse movements if ((this.Dock == DockStyle.Top) || (this.Dock == DockStyle.Left)) { xDelta = -xDelta; yDelta = -yDelta; } // New size is original size plus delta if ((this.Dock == DockStyle.Top) || (this.Dock == DockStyle.Bottom)) { Parent.ClientSize = new Size(this._Size.Width, this._Size.Height + yDelta); } else if ((this.Dock == DockStyle.Left) || (this.Dock == DockStyle.Right)) { Parent.ClientSize = new Size(this._Size.Width + xDelta, this._Size.Height); } // Force a repaint of parent so we can see changed appearance Parent.Refresh(); } } // Ensure delegates are called base.OnMouseMove(e); return; }
//===================================================================== public DockingControlResizer(DockStyle ds) { this.Dock = DockingControl.ResizeStyleFromControlStyle(ds); this.Size = new Size(DockingControlResizer.FIXED_LENGTH, DockingControlResizer.FIXED_LENGTH); return; }