如何为DataGridView中存在的复选框设置颜色?
我在Windows表单中有一个DataGridView。看起来像这样。
在此中,有一个复选框列,两个文本框列。
我的要求是需要将Readonly True设置为True,并为该国的复选框设置灰色,如下所示。
不喜欢下面的
我需要为复选框设置颜色,而不是为datagridview单元格。
有人对此有主意吗?
I have a datagridview in windows form. It looks like this.
In this, have one Checkbox column, two textbox column.
My requirement is need to set readonly true and set grey color for the checkbox for the country has Germany as like below.
Not like below
I need to set color for checkbox only not for datagridview cell.
Is anyone have idea for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
给定答案在这里 和稍微更改
结果
Given the answer here and slightly change it
Result
您可以通过设置Checkbox的属性来实现:“启用”为false。
这样,无法单击复选框,其颜色会自动更改为灰色。
示例
You can achieve that by setting checkbox's property: 'Enabled' as false.
by that way, the checkbox cannot be clicked and its color changes automatically to grey.
Example