// SECREVIEW: This seems safe, but could anything dangerous occur here? protected override void OnMouseUp(MouseEventArgs me) { if (dividerMoveY == -1) return; Cursor = null; DividerDraw(dividerMoveY); dividerMoveY = DividerLimitMove(targetMove, me.Y); Rectangle rectDoc = targetMove.Bounds; if (dividerMoveY != rectDoc.Y) { int yNew = rectDoc.Height + rectDoc.Y - dividerMoveY - (CYDIVIDER / 2); // we subtract two so the mouse is still over the divider Size size = targetMove.Size; size.Height = Math.Max(0,yNew); targetMove.Size = size; targetMove.userSized = true; OnLayoutInternal(true); // invalidate the divider area so we cleanup anything // left by the xor Invalidate(new Rectangle(0, me.Y - CYDIVIDER, Size.Width, me.Y + CYDIVIDER)); // in case we're doing the top one, we might have wrecked stuff // on the grid gridView.Invalidate(new Rectangle(0, gridView.Size.Height - CYDIVIDER, Size.Width, CYDIVIDER)); } // end the move CaptureInternal = false; dividerMoveY = -1; targetMove = null; base.OnMouseUp(me); }
private int DividerLimitMove(SnappableControl target, int y) { Rectangle rectTarget = target.Bounds; int cyNew = y; // make sure we're not going to make ourselves zero height -- make 15 the min size cyNew = Math.Min((rectTarget.Y + rectTarget.Height - 15),cyNew); // make sure we're not going to make ourselves cover up the grid cyNew = Math.Max(DividerLimitHigh(target), cyNew); // just return what we got here return(cyNew); }
// SECREVIEW: This seems safe, but could anything dangerous occur here? protected override void OnMouseDown(MouseEventArgs me) { SnappableControl target = DividerInside(me.X,me.Y); if (target != null && me.Button == MouseButtons.Left) { // capture mouse. CaptureInternal = true; targetMove = target; dividerMoveY = me.Y; DividerDraw(dividerMoveY); } base.OnMouseDown(me); }
private int DividerLimitHigh(SnappableControl target) { int high = gridView.Location.Y + MIN_GRID_HEIGHT; if (target == doccomment && hotcommands.Visible) high += hotcommands.Size.Height + 2; return high; }
private int DividerLimitMove(SnappableControl target, int y) { Rectangle bounds = target.Bounds; int num = y; num = Math.Min((bounds.Y + bounds.Height) - 15, num); return Math.Max(this.DividerLimitHigh(target), num); }
private int DividerLimitHigh(SnappableControl target) { int num = this.gridView.Location.Y + 20; if ((target == this.doccomment) && this.hotcommands.Visible) { num += this.hotcommands.Size.Height + 2; } return num; }
protected override void OnMouseUp(MouseEventArgs me) { if (this.dividerMoveY != -1) { this.Cursor = null; this.DividerDraw(this.dividerMoveY); this.dividerMoveY = this.DividerLimitMove(this.targetMove, me.Y); Rectangle bounds = this.targetMove.Bounds; if (this.dividerMoveY != bounds.Y) { int num = ((bounds.Height + bounds.Y) - this.dividerMoveY) - 1; Size size = this.targetMove.Size; size.Height = Math.Max(0, num); this.targetMove.Size = size; this.targetMove.userSized = true; this.OnLayoutInternal(true); base.Invalidate(new Rectangle(0, me.Y - 3, base.Size.Width, me.Y + 3)); this.gridView.Invalidate(new Rectangle(0, this.gridView.Size.Height - 3, base.Size.Width, 3)); } base.CaptureInternal = false; this.dividerMoveY = -1; this.targetMove = null; base.OnMouseUp(me); } }
protected override void OnMouseDown(MouseEventArgs me) { SnappableControl control = this.DividerInside(me.X, me.Y); if ((control != null) && (me.Button == MouseButtons.Left)) { base.CaptureInternal = true; this.targetMove = control; this.dividerMoveY = me.Y; this.DividerDraw(this.dividerMoveY); } base.OnMouseDown(me); }