C# を使用して、Windows フォームでデータグリッドビューをカスタマイズしたいと考えています。私がやりたいことは、作成したグラデーションでデータグリッド ヘッダーをペイントすることです。
public void Colorear_Barra_abajo(object sender, PaintEventArgs e)
{
Rectangle r = new Rectangle(0,0, panel_Borde_abajo.Width, panel_Borde_abajo.Height);
if (r.Width > 0 && r.Height > 0)
{
Color c1 = Color.FromArgb(255, 54, 54, 54);
Color c2 = Color.FromArgb(255, 62, 62, 62);
Color c3 = Color.FromArgb(255, 98, 98, 98);
LinearGradientBrush br = new LinearGradientBrush(r, c1, c3, 90, true);
ColorBlend cb = new ColorBlend();
cb.Positions = new[] { 0, (float)0.5, 1 };
cb.Colors = new[] { c1, c2 , c3 };
br.InterpolationColors = cb;
// paint
e.Graphics.FillRectangle(br, r);
}
}
問題は、datagridviews にはペイント イベントがないため、これを使用できないことです。ヘッダーをグラデーションでペイントする方法はありますか? それとも、背景色を 1 つ選択するしか方法はありませんか?
ありがとう..