protected override void OnMouseClick(DataGridViewCellMouseEventArgs e) { Point p = new Point(e.X + _cellLocation.X, e.Y + _cellLocation.Y); if (p.X >= checkBoxLocation.X && p.X <= checkBoxLocation.X + checkBoxSize.Width && p.Y >= checkBoxLocation.Y && p.Y <= checkBoxLocation.Y + checkBoxSize.Height) { _checked = !_checked; datagridviewCheckboxHeaderEventArgs ex = new datagridviewCheckboxHeaderEventArgs(); ex.CheckedState = _checked; object sender = new object(); if (OnCheckBoxClicked != null) { OnCheckBoxClicked(sender, ex); this.DataGridView.InvalidateCell(this); } } base.OnMouseClick(e); }
/// <summary> /// 多选按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public virtual void ch_OnCheckBoxClicked(object sender, datagridviewCheckboxHeaderEventArgs e) { }