Menu

#12 Can not change drawing color, using C sharp

open
nobody
None
5
2014-07-25
2011-08-28
millsmess
No

I am using C# in .NET do this.
When I tell it to draw something using code like this: graphics.DrawLine(Pens.Orange, drawPoint1, drawPoint2); the drawing always comes out blue.
I have this code at the top - using System.Drawing - which allows me to change the color of other things, like my robot.
The code is like this:
public override void OnPaint(IGraphics graphics)
{
Point drawPoint1 = new Point();
drawPoint1.X = (int)X;
drawPoint1.Y = (int)Y;

        Point drawPoint2 = new Point();
        drawPoint2.X = (int)X+100;
        drawPoint2.Y = (int)Y+100;

        graphics.DrawLine(Pens.Orange, drawPoint1, drawPoint2);

        base.OnPaint(graphics);

    }

Thanks!

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.