更新时间:2023-12-03 12:37:28
我发现禁用"突出显示的唯一方法是设置 SelectionBackColor
和 SelectionForeColor
在 DefaultCellStyle
中分别与 BackColor
和 ForeColor
相同.您可能可以在表单的 Load
事件上以编程方式执行此操作,但我也在设计器中执行此操作.
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