Disable Cell Highlighting in a datagridview

前端 未结 10 1934
后悔当初
后悔当初 2020-12-08 13:30

How to disable Cell Highlighting in a datagridview, Highlighting should not happen even if I click on the cell.

Any thoughts please

10条回答
  •  一个人的身影
    2020-12-08 13:57

    The ForeColor/BackColor kludge wasn't working for me, because I had cells of different colors. So for anyone in the same spot, I found a solution more akin to actually disabling the ability.

    Set the SelectionChanged event to call a method that runs ClearSelection

    private void datagridview_SelectionChanged(object sender, EventArgs e)
    {
        this.datagridview.ClearSelection();
    }
    

提交回复
热议问题