Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line drawing problem - pen changing color

Status
Not open for further replies.

paskuda

Programmer
Jan 27, 2005
104
PL
Hello,
I just started learning C# and have a problem with drawing. I have a small piece of code where I draw to a bitmap defined in memory and then draw the bitmap on the form using the Paint event. I have a piece of code like this :
Code:
Graphics objGraphics;
Pen mypen;
// some code I cut 
mypen = new Pen(System.Drawing.Color.White);
objGraphics.DrawLine(mypen, 0, 10, drawingArea.Width, 10);
objGraphics.DrawLine(mypen, 0, 20, drawingArea.Width, 20);
objGraphics.DrawLine(mypen, 0, 30, drawingArea.Width, 30);
This should, afair, produce three parallel white lines, and it does indeed, except the color.
The color changes on each line. When I tried to draw more lines I noticed that the color changes in cycles - first line is white, then next five lines have different colors (all variations of grey), then it starts again.
Any hints on that ? I'm pretty lost ...

Mike
 
I don't think it's a GDI/GDI+ problem. I think it's a display artifact. So,

1. What type of monitor are you using?
2. Do you have ClearType turned on?

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Chip,

Thank you for your reply.
1. It's an LCD display, I'm working on IBM R50e laptop
2. I didn't have it on, now it's o, no change

I uploaded a screenshot of my form - it's here. I know it's large, but I didn't want any compression, I wanted the image to be exactly the same as in my program.

Any more ideas ?

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top