how can i change the font color of a specified Cell forexample named "VRequire" in some condtion ,for example when it is over 10?
private void StyleCalculateGrid()
{
DataGridTableStyle DcStyle=new DataGridTableStyle();
DcStyle.HeaderForeColor=Color.WhiteSmoke;
DcStyle.HeaderBackColor=Color.Blue;
DcStyle.HeaderFont= new Font("Verdana",10,FontStyle.Bold);
foreach(DataColumn dc in ds.Tables["TblCTVKnee"].Columns)
{
DataGridTextBoxColumn textColumn=new DataGridTextBoxColumn();
textColumn.MappingName= dc.ColumnName;
textColumn.HeaderText = dc.Caption;
if(dc.ColumnName.ToString()=="CoreNo")
textColumn.Width=0;
else if(dc.ColumnName.ToString()=="id_CTVknee")
textColumn.Width=0;
else if(dc.ColumnName.ToString()=="id_CT")
textColumn.Width=0;
else if(dc.ColumnName.ToString()=="id_proj")
textColumn.Width=0;
else
switch (cmbCtClass.Text.ToString())
{
case "TPY":
if(dc.ColumnName.ToString()=="CTVKnee")
{
textColumn.HeaderText="CT (Vknee)"; textColumn.Width=myDataGrid.Width/2-10;
}
else if (dc.ColumnName.ToString()=="VRequire")
{
textColumn.HeaderText="V Require"; textColumn.Width=myDataGrid.Width/2-10;
}
case "M":
if(dc.ColumnName.ToString()=="CTVKnee")
{ textColumn.HeaderText="CT (Vknee)"; textColumn.Width=0; } else if (dc.ColumnName.ToString()=="VRequire")
textColumn.Width=0;
else if (dc.ColumnName.ToString()=="SCMax") { textColumn.HeaderText="SC Max"; textColumn.Width=105; }
}
DcStyle.GridColumnStyles.Add(textColumn);
}
DcStyle.MappingName=ds.Tables["TblCTVKnee"].TableName;
if (myDataGrid.TableStyles.Count>0) myDataGrid.TableStyles.Clear();
myDataGrid.TableStyles.Add(DcStyle);
String Str ="id_CT= " + IdCT DataView mydataView = new DataView();
mydataView.Table = ds.Tables["TblCTVKnee"];
mydataView.RowFilter = Str;
myDataGrid.DataSource=mydataView;
myDataGrid.Refresh();
}