Cellborder datagridview

ankit goel 746 Reputation points
2023-10-25T03:28:19.9833333+00:00

Hi ,

in my datagridview , i have turned off the cell border by using
this.CellBorderStyle = DataGridViewCellBorderStyle.None;

User's image

but still when its cell gets focused by using mouse , i can there there is a dashed line type border in the cell . To prevent this , i tried using

this.SelectionMode = DataGridViewSelectionMode.FullRowSelect , but no success . How to prevent this please suggest

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,865 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,523 questions
{count} votes

Accepted answer
  1. gekka 7,826 Reputation points MVP
    2023-10-25T03:57:37.8566667+00:00
    this.dataGridView1.CellPainting += (s, e) =>
    {
        if (e.ColumnIndex == 1)
        {
            e.Paint(e.ClipBounds, e.PaintParts & ~DataGridViewPaintParts.Focus);
            e.Handled = true;
        }
    };
    

0 additional answers

Sort by: Most helpful