如何禁用单元格突出显示在一个DataGridView, 如果我点击单元格高亮不应该发生,即使。
How to disable Cell Highlighting in a datagridview, Highlighting should not happen even if I click on the cell.
任何想法请
我发现为禁用,突出的唯一方法是设置的SelectionBackColor
和 SelectionForeColor
在 DefaultCellStyle
以相同背景色
和前景色
,分别。你也许可以做到这一点编程的表单中的加载
事件,但我已经在设计师也做到了。
The only way I've found to "disable" highlighting is to set the SelectionBackColor
and the SelectionForeColor
in the DefaultCellStyle
to the same as the BackColor
and ForeColor
, respectively. You could probably do this programmatically on the form's Load
event, but I've also done it in the designer.
事情是这样的:
Me.DataGridView1.DefaultCellStyle.SelectionBackColor = Me.DataGridView1.DefaultCellStyle.BackColor
Me.DataGridView1.DefaultCellStyle.SelectionForeColor = Me.DataGridView1.DefaultCellStyle.ForeColor