C# DevComponents DotNetBar SuperGridControl:如何仅更改一行';背景色

C# DevComponents DotNetBar SuperGridControl:如何仅更改一行';背景色,c#,winforms,dotnetbar,C#,Winforms,Dotnetbar,正如主题所示,我的Windows窗体上有一个DevComponents DotNetBar SuperGridControl(SGC)。在SGC中,我有交替的行颜色。SGC中的一列具有布尔值(数据中的启用/禁用标志) 我只想更改标记为假布尔值的行的背景色 我尝试用于执行此任务的代码: private void dgvSearchResults_PostRenderRow(object sender, GridPostRenderRowEventArgs e) {

正如主题所示,我的Windows窗体上有一个DevComponents DotNetBar SuperGridControl(SGC)。在SGC中,我有交替的行颜色。SGC中的一列具有布尔值(数据中的启用/禁用标志)

我只想更改标记为假布尔值的行的背景色

我尝试用于执行此任务的代码:

    private void dgvSearchResults_PostRenderRow(object sender, GridPostRenderRowEventArgs e)
    {
        if (e.RenderParts != RenderParts.Background) { return; }

        var row = (GridRow)e.GridRow;

        if (((CustomerDTO)row.DataItem).Disabled)
        {
            //Try to figure out how to set the row color here.
        }
    }
令人讨厌的是,这段代码显然对SGC中的每一行运行两次。但是,撇开这一部分不谈,当我进入.Disabled控件语句时,似乎没有任何方法可以更改我所在行的行颜色


我喜欢任何提示或建议。

所以我确实找到了这个问题的答案,结果证明它相当简单。我只是调用了错误的事件处理程序。下面的代码执行我在初始问题中尝试的任务:

    private void dgvSearchResults_GetRowCellStyle(object sender, GridGetRowCellStyleEventArgs e)
    {
        if (e.StyleType != StyleType.Default) { return; }

        var row = e.GridRow as GridRow;
        if (row == null) { return; }

        if (((CustomerDTO)row.DataItem).Disabled) {
            e.Style.Background = new Background(Color.Tomato);
        }
    }