Si consideri il seguente codice da uno standard System.Windows.Forms.Form
LinearGradientBrush non rende correttamente
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Rectangle test = new Rectangle(50, 50, 100, 100);
using (LinearGradientBrush brush = new LinearGradientBrush(test, Color.Red, Color.Blue, 0f))
{
e.Graphics.DrawRectangle(new Pen(brush, 8), test);
}
}
Produce questo risultato:
Perché sono le linee rosse e blu che mostra nell'ordine errato e come può essere risolto?