Note that there are some explanatory texts on larger screens.

plurals
  1. POSet ForeColor & BackgroundColor of each Column For Each Row Separately in .Net Compact Framework 3.5
    primarykey
    data
    text
    <p>I am developing a Window CE 5 Program With Visual Studio 2008. </p> <p>By using a DataGrid Control in one of my forms, I need to change each row background and forecolor depending on some conditions. for doing this, I use this class: </p> <pre><code>public class ColoredDataGridTextBoxColumn : DataGridTextBoxColumn { public Color BackgroundColor { get; set; } public Color ForeColor { get; set; } public ColoredDataGridTextBoxColumn() { BackgroundColor = Color.White; ForeColor = Color.Black; } protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight) { backBrush = new SolidBrush(BackgroundColor); base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight); } } </code></pre> <p>for creating rows and columns of grid, i use this way:</p> <pre><code>var dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("ّFirstName", typeof(string))); var tableStyle = new DataGridTableStyle(); var tbcFirstName = new ColoredDataGridTextBoxColumn { Width = 65, MappingName = "FirstName", HeaderText = "نام" }; var tableStyle = new DataGridTableStyle(); dgDeliverData.TableStyles.Clear(); dgDeliverData.TableStyles.Add(tableStyle); for (int index = 0; index &lt; LstMemberNames.Length; index++) { var memberName = LstMemberNames[index]; var row = dataTable.NewRow(); row["FirstName"] = memberName; dataTable.Rows.Add(row); } dgDeliverData.DataSource = dataTable; </code></pre> <p>now i want change <code>row</code> background color &amp; fore color if <code>memberName</code> for eg: is equal to 'member1'.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload