System.Windows.Forms.DataGridView.OnMouseClick(System.Windows.Forms.MouseEventArgs)

Here are the examples of the csharp api class System.Windows.Forms.DataGridView.OnMouseClick(System.Windows.Forms.MouseEventArgs) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

View license
protected override void OnMouseClick(MouseEventArgs e)
        {
            DataGridView.HitTestInfo hti = this.HitTest(e.X, e.Y);
            if (hti.Type == DataGridViewHitTestType.Cell)
            {
                DataGridViewCell c = this[hti.ColumnIndex, hti.RowIndex];
                if (c.Value == null || c.Value.Equals(""))
                {
                    c.Style.BackColor = Color.Transparent;
                    c.Style.SelectionBackColor = Color.Transparent;
                }
                else
                {
                    c.Style.BackColor = Color.CornflowerBlue;
                    c.Style.SelectionBackColor = Color.CornflowerBlue;
                }
            }
            base.OnMouseClick(e);
        }