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

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

问题描述

如何禁用单元格突出显示在一个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

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

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