我想更改RadGrid Telerik中列的颜色。我想给颜色col index 2,3
和不同颜色的col Index 0,1
。Telerik CellFormatting列颜色不起作用
的颜色山坳2,3是工作,但对于Col index 0,1 is not working,
有索引Col index 0 & 1
这没有颜色是代码:
bool dontRunHandler;
private void datagridview_CellFormatting(object sender, CellFormattingEventArgs e)
{
e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.NumberOfColorsProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
if (dontRunHandler == false)
{
if (e.CellElement.ColumnIndex != 2 && e.CellElement.ColumnIndex != 3) return;
e.CellElement.DrawFill = true;
e.CellElement.NumberOfColors = 1;
e.CellElement.BackColor = Color.LightSlateGray;
e.CellElement.GradientStyle = GradientStyles.Linear;
}
else
{
if (e.CellElement.ColumnIndex != 0 && e.CellElement.ColumnIndex != 1) return;
e.CellElement.DrawFill = true;
e.CellElement.NumberOfColors = 1;
e.CellElement.BackColor = Color.MediumVioletRed;
e.CellElement.GradientStyle = GradientStyles.Linear;
}
}
我想我需要澄清你是什么今天早些时候之后。我将于下午1点左右在CST的聊天室汤姆下午。 – KreepN
KreepN:我正在做这个Telerik的东西的地方,我不能使用聊天功能被禁用,包括SO聊天,但我可以访问SO网络。我会让你知道,今天晚上我该做什么。谢谢。如果其他人删除 – linguini