【问题标题】:How to set custom text to a GroupRow in the CustomDrawGroupRow event of a DevExpress GridControl?如何在 DevExpress GridControl 的 CustomDrawGroupRow 事件中将自定义文本设置为 GroupRow?
【发布时间】:2019-11-06 23:21:51
【问题描述】:

我正在寻找一种在 CustomDrawGroupRow 事件中设置 GroupRow 文本而不设置 e.Handled = true 的方法,因为我还需要应用基础绘图:

this.gridView.CustomDrawGroupRow += (s, e) => 
{
    /* set the GroupRow text here without using e.Handled = true */
}

我尝试过使用e.Graphics.DrawString,但我不能使用e.Appearance.BackColor,因为我需要设置e.Handled = true 来绘制string,它会禁用它

【问题讨论】:

    标签: c# devexpress devexpress-windows-ui


    【解决方案1】:

    您需要将e.Info 转换为GridGroupRowInfo 并将GridGroupRowInfo.GroupText 设置为您的值:

    using DevExprss.XtraGrid.Views.Grid.ViewInfo;
    
    ...
    
    this.gridView.CustomDrawGroupRow += (s, e) => 
    {
        GridGroupRowInfo groupInfo = e.Info as GridGroupRowInfo;
        groupInfo.GroupText = "Custom group text";
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多