如何将 cxGrid 列中的复选框设为灰色
在 cxGrid 中,我有一列属性 Options.Editing:=False;属性:=复选框
。因此,用户无法更改复选框的状态。但复选框仍然具有自定义颜色,用户看不到他无法编辑它们。
如何使 cxGrid 列中的复选框变为灰色,而该列无法编辑?
In cxGrid I have a column with property Options.Editing:=False; Properties:=CheckBox
. So, user can not change state of the checkboxes. But the checkboxes still have custom color and user does't see that he can not edit them.
How do I make checkboxes grey in a cxGrid column, which one can not edit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用 OnCustomDrawCell 事件来绘制禁用的复选框。
查看:http://www.devexpress.com/Support/Center/p/ Q253981.aspx
You can use OnCustomDrawCell event to draw a disabled checkbox.
Check out: http://www.devexpress.com/Support/Center/p/Q253981.aspx
您可以在网格视图上创建一个 OnCustomDrawCell 事件,如下所示:
You could make an OnCustomDrawCell event on the grid view, with something like:
不可编辑的列不会变成灰色。这适用于所有类型的编辑器,无论是复选框、文本编辑还是其他编辑器。该复选框有一个 NullStyle 属性,可以设置为 nssGrayedChecked,但这只会在 NULL 值时显示。
不过,您还有其他选择。最简单的可能是将列设置为不可聚焦,以及不可编辑(Options.Focusing = false)。这也许会让您的用户更容易理解为什么他们无法更改该值。第二个最简单的选项是使用自定义样式,该样式以某种方式指示禁用/不可编辑的列,例如通过使用灰色背景颜色。
Columns that are not editable will not become grey. This goes for all kinds of editors, be they checkboxes, textedits or whatever. The checkbox has a property for NullStyle that can be set to nssGrayedChecked, but this will only be displayed for NULL values.
You have some other options, though. The simplest may be to set the column to not focusable, as well as not editable (Options.Focusing = false). This will perhaps make it easier for your users to understand why they can't change the value. THe second easiest option is to use a custom style that in some way indicates a disabled/noneditable column, for instance by having a grey background color.
使用 cxStyleRepository
Use cxStyleRepository