protected override void OnMouseDown(GLMouseEventArgs e) { base.OnMouseDown(e); if (e.Button == GLMouseEventArgs.MouseButtons.Left) { GLDataGridView dgv = Parent as GLDataGridView; if (dgv.AllowUserToResizeColumns && e.Location.X >= Width + leftmargin) { dragging = -2; return; } var g = contentpanel.GridRowCol(e.Location); if (g != null) { //System.Diagnostics.Debug.WriteLine($"Grid {g.Row} {g.Column} {g.Location}"); if (dgv.AllowUserToResizeRows && g.Location.Y >= dgv.Rows[g.Row].Height - bottommargin) { dragging = g.Row; draggingstart = e.Location.Y - g.Location.Y; // compute where top line, based on location, would be } else if (dgv.AllowUserToSelectRows) { //System.Diagnostics.Debug.WriteLine($"Selection start on {g.Row}"); bool itwason = dgv.Rows[g.Row].Selected; dgv.ClearSelection(); if (!itwason) { lastselectionstart = lastselectionend = selectionstart = g.Row; dgv.Rows[selectionstart].Selected = true; } } } } }
protected override void OnMouseDown(GLMouseEventArgs e) { base.OnMouseDown(e); if (e.Button == GLMouseEventArgs.MouseButtons.Left) { GLDataGridView dgv = Parent as GLDataGridView; var g = GridRowCol(e.Location); if (g != null) { var newcell = CellPara(g, e); // may return null if cell not there newcell?.OnMouseCellDown(e); if (!e.Handled && dgv.AllowUserToSelectCells && g.Column < dgv.Rows[g.Row].CellCount) { lastselectionstart = lastselectionend = selectionstart = g; dgv.ClearSelection(); dgv.Rows[g.Row].Cells[g.Column].Selected = true; } } } }