I have problem with draw two polygons. I want to fill two triangles, but one is greater than the second. I am using UserControl in winforms. Code:
Point[] DOWN = new Point[] {new Point(0, 0), new Point(10, 0), new Point(5, 5)};
Point[] UP = new Point[] { new Point(0, 15), new Point(10, 15), new Point(5, 10) };
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            SolidBrush brush = new SolidBrush(Color.FromArgb(253, 198, 19));       
            e.Graphics.FillPolygon(brush, DOWN);
            e.Graphics.FillPolygon(brush, UP);
            brush.Dispose();
        }
Where is problem?
Try setting the PixelOffsetMode property:
e.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
using (SolidBrush brush = new SolidBrush(Color.FromArgb(253, 198, 19))) {
  e.Graphics.FillPolygon(brush, DOWN);
  e.Graphics.FillPolygon(brush, UP);
}
Result:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With