如何在radGridView中设置标题的背景颜色

时间:2013-10-06 13:13:45

标签: c# winforms telerik-grid radgridview

我想改变radGridView中标题的背面颜色。除了使用主题之外,还有什么办法可以改变吗?(winform)

1 个答案:

答案 0 :(得分:1)

private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement is GridHeaderCellElement)
    {
        if (e.CellElement.Text == "Your header cell text") //checking for the text in header cell
        {
            e.CellElement.DrawBorder = true;
            e.CellElement.DrawFill = true;
            e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
            e.CellElement.BackColor = Color.Green;
            e.CellElement.ForeColor = Color.Red;
        }
    }
}