gpt4 book ai didi

c# - 帮助 C# DevExpress XtraGrid GridControl - 使单元格中的复选框不可见

转载 作者:太空宇宙 更新时间:2023-11-03 18:18:26 25 4
gpt4 key购买 nike

我有一个 GridControl View ,该 View 正在填充一列作为 bool 值,以将值显示为复选框。

但是,我希望根据其他列的状态隐藏一些复选框。我尝试使用 gridView_CustomDrawCell()事件,但找不到合适的属性。

我希望找到 visible属性设置为 false 但似乎没有。

也许可以在填充 View 时隐藏复选框,但我想不出一个。

有谁知道这是否可能,以及如何?

非常感谢!

最佳答案

您可以尝试清除 Graphics并将事件标记为已处理:

private void gridView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
if (ConditionIsMet())
{
e.Graphics.Clear(e.Appearance.BackColor);
e.Handled = true;
}
}

如果它不起作用,这是另一个想法:处理 CustomRowCellEditCustomRowCellEditForEditing事件,并删除编辑器:
private void gridView_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
{
if (ConditionIsMet())
{
e.RepositoryItem = null;
}
}

关于c# - 帮助 C# DevExpress XtraGrid GridControl - 使单元格中的复选框不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2418434/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com