2011-12-10 22 views
1

我怎樣才能符合條件改變背景色列當Gridex(GridJanus)在c#如何改變背景色行劍鋒電網與條件

感謝

+0

這是不夠清晰 - 你能告訴我們一些代碼?到目前爲止你做了什麼??什麼**條件**你想基於你的決定?你需要詳細說明一下.... –

回答

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; 
      } 
     } 
    } 
} 
+0

但是當滾動gridex然後格式化回正常? –

4

我不能直接鏈接到它,但我發現本帖由Ravi KotaJanus Systems論壇發表。我目前無法對此進行測試,而且這是一個較舊的帖子......從概念上講,它看起來不錯。

GridEXFormatCondition fc; 

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

fc.FormatStyle.ForeColor = Color.Blue; 

GridName.RootTable.FormatConditions.Add(fc); 
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; 
      } 
     } 
    }