Rozważmy następujący kod ze standardowej System.Windows.Forms.Form
LinearGradientBrush nie czyni prawidłowo
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);
}
}
produkuje ten wynik:
Dlaczego są czerwone i niebieskie linie pojawiają się w niewłaściwej kolejności i jak można to naprawić?