在 datagridview 中禁用单元格突出显示 [英] Disable Cell Highlighting in a datagridview

查看:26
本文介绍了在 datagridview 中禁用单元格突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在数据网格视图中禁用单元格突出显示,即使我点击单元格也不应该突出显示.

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

任何想法请

推荐答案

我发现禁用"突出显示的唯一方法是设置 SelectionBackColorSelectionForeColorDefaultCellStyle 中分别与 BackColorForeColor 相同.您可能可以在表单的 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

这篇关于在 datagridview 中禁用单元格突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆