Windows Develop Bookmark and Share   
 index > Windows Forms General > Graphics Class: Can I Plot a Single Point?
 

Graphics Class: Can I Plot a Single Point?

I was wondering if the Graphics class provides a way to plot a single Point. I've been programming for a long time, and usually, the first function you find when dealing with graphics is a plot function that draws a single point in a particular color.
With the Graphics class, I can do all kinds of great things with lines, rectangles, curves, etc., but not a single point. The best I've been able to come up with, so far, is to draw a line with a length of 1 and then offset it by .5 units. That seems to draw a point. But there must be a different way. Right???
I'm simply trying to paint a single point in a control's client area--without using an image
Any help would be appreciated.
Thanks,
ravenhunter

ravenhunter  Saturday, March 22, 2008 4:19 PM

Have a look at the Bitmap.SetPixel method.

Docs at: http://msdn2.microsoft.com/en-us/library/system.drawing.bitmap.setpixel.aspx.

Bobby

hodge  Saturday, March 22, 2008 7:54 PM

Not to my knowledge, probably better or more accurate touse FillRectangle(Brushes.Black, x, y, 1, 1) depending on the PageScale/GraphicsUnit used.

яeverser  Saturday, March 22, 2008 4:53 PM

Have a look at the Bitmap.SetPixel method.

Docs at: http://msdn2.microsoft.com/en-us/library/system.drawing.bitmap.setpixel.aspx.

Bobby

hodge  Saturday, March 22, 2008 7:54 PM

You can use google to search for other answers

Custom Search

More Threads

• separating raid buttons on my form
• Enabling a tool bar Via MDI Child
• A date Question
• Forcing Validating/Validated event when a ToolStripItem is clicked
• Displaying Flash with webbrowser control res protocol...doesn't work....why?
• Programmatically determining the Internet trust permission set
• How to open a Form?
• How to: Webbrowser NewWindow and Navigating equivalent to axWebbrowser
• OnPaintBackground still getting called after AllPaintingInWmPaint and UserPaint are set...
• Designer problem with tabpages