Subject: Plotting points for math program
Posted By: chroniclemaster1 Post Date: 5/12/2008 8:54:42 PM
I'm building an application for a graduate math class. I need to calculate values at each point on a graph and assign a color to that pixel. My problem is that I can't find a way to control the color of a single pixel. There doesn't seem to be a method of the graphics object I'm using that supports that. I've also tried configuring the methods that are there DrawLine, DrawRectangle, DrawEllipse and adjusting settings for the degenerate case of a point. However, the smallest I can get is a 1 pixel by 2 pixel line segment (2 pixels), if I push it smaller, it doesn't output anything at all (0 pixels). How can I control and paint just 1 pixel for my project?

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Reply By: samjudson Reply Date: 5/13/2008 3:08:59 AM
Bitmap.SetPixel is probably your best bet. For this you will likely need to draw to a bitmap and then copy the bitmap to the final destination.

/- Sam Judson : Wrox Technical Editor -/
Reply By: chroniclemaster1 Reply Date: 5/13/2008 9:05:27 PM
That's doable, in fact it's probably better practice isn't it? Then I can load the bitmap in the onPaint event.

So I'll be manipulating a bitmap directly instead of manipulating a graphics object (like I do when using DrawLine, etc.)? I'll probably be back with bitmap implementation questions later then.

Thanks!

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.

Go to topic 71294

Return to index page 1