Example #1
0
        private void Button1_MouseDown(object sender, MouseEventArgs e)
        {
            int index = (int)this.numericUpDownColumn.Value;
            var col   = this.control.Columns[index];

            this.resizeDragInfo = new ResizeDragInfo(col, e.X);
        }
        public static void ResizeDrag(ResizeDragInfo dragInfo, int mouseX, int minimumColumnWidth)
        {
            if (!dragInfo.Active)
            {
                return;
            }
            int dx = mouseX - dragInfo.MouseX;

            dragInfo.Column.Width = Math.Max(minimumColumnWidth, dragInfo.StartWidth + dx);
        }
Example #3
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     if (e.Button != MouseButtons.Left)
     {
         return;
     }
     int[] columnWidths = ColumnPositioning.CalculateColumnWidths(this.Columns, this.Width, 10, out _, out _);
     ColumnPositioning.HitTest(columnWidths, this.GetHScrollValue(), e.X, 5, out int columnIndex, out bool resizeHandle);
     if (resizeHandle)
     {
         this.resizeDragInfo = new ResizeDragInfo(this.Columns[columnIndex], e.X);
     }
 }
Example #4
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     if (e.Button == MouseButtons.Right && this.resizeDragInfo.Active)
     {
         // Right click during resize - revert
         this.resizeDragInfo.Column.Width = this.resizeDragInfo.StartWidth;
         this.resizeDragInfo = default(ResizeDragInfo);
         this.RecalculateScrollBar();
         return;
     }
     if (e.Button != MouseButtons.Left)
     {
         return;
     }
     this.resizeDragInfo = default(ResizeDragInfo);
 }
Example #5
0
 private void Button1_MouseUp(object sender, MouseEventArgs e)
 {
     this.resizeDragInfo = default(ResizeDragInfo);
 }