我在 WinUI C:\Program Files (x86)\Telerik\UI for WinForms Q1 2015\Examples\QuickStart\GridView\Rows\AddNewRow\Form1.cs 的 Telerik 示例中使用了网格,并添加了以下代码以获取 UnitPrice蓝色字体:
public Form1()
{
...
this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting);
}
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
GridDataCellElement dataCell = e.CellElement as GridDataCellElement;
if (dataCell != null)
{
if (dataCell.ColumnInfo.Name.ToLower() == "unitprice")
{
dataCell.ForeColor = System.Drawing.Color.Blue;
dataCell.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
}
}
}
这在表单首次加载时有效:
如果我垂直滚动表单,其他一些列也会变成蓝色。对此我能做些什么吗?