如何在条件下改变Janus Grid中的背色行

时间:2011-12-10 11:27:30

标签: c# janus

如何使用c#

中的条件更改背景颜色行GridEx(GridJanus)

感谢

3 个答案:

答案 0 :(得分:4)

我无法直接链接到它,但我在Janus Systems论坛上的 Ravi Kota 的帖子中找到了这个帖子。我目前无法对此进行测试,这是一个较旧的帖子......从概念上看,它看起来是正确的。

GridEXFormatCondition fc;

fc = new GridEXFormatCondition(GridName.RootTable.Columns[ColumnName], ConditionOperator.GreaterThan, 0);

fc.FormatStyle.ForeColor = Color.Blue;

GridName.RootTable.FormatConditions.Add(fc);

答案 1 :(得分:1)

private void Grd_Detail_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
{
    int i = 1;
    for (i = 0; i < Grd_Detail.RowCount; i++)
    {
        string s = Grd_Detail.GetRow(i).Cells["FN"].Value.ToString();
        if (s == "True")
        {
            if (e.Row.RowType == Janus.Windows.GridEX.RowType.Record)
            {                 
                Janus.Windows.GridEX.GridEXFormatStyle rowcol = new GridEXFormatStyle();
                rowcol.BackColor = Color.LightGreen;
                Grd_Detail.GetRow(i).RowStyle = rowcol;
            }
        }
    }
}

答案 2 :(得分:1)

在LoadingRow事件格式行:

private void MyGridEX_LoadingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
    {
        if (e.Row.RowType == Janus.Windows.GridEX.RowType.Record)
        {
            if ((bool)e.Row.Cells[0].Value)
            {
                Janus.Windows.GridEX.GridEXFormatStyle style = new Janus.Windows.GridEX.GridEXFormatStyle();
                style.ForeColor = Color.Red;
                e.Row.RowStyle = style;
            }
        }
    }