This is a double bad idea. First, do you really need to draw one point? I doubt it. Usually, you need to draw many points, so drawing anything point by point is prohibitively slow. If you need it, you need to do it only on a bitmap, using this:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.lockbits.aspx[
^].
There is a similar approach for WPF, which you are probably not using here.
Another big misconception is using
PictureBox
. You never ever need to use this control for anything except a static image. In principle you could, but it would be totally redundant, not helping you at all, only wasting your development time, and run-time resources. You need to render some image on a bitmap or on screen.
PictureBox
is nothing but a middleman for this, to simplify the chores, but only for the simplest situation. I will explain what to do instead, if you need to draw anything on screen, which always means in some control. Draw in this control, nowhere else! Please see my past answers:
How do I clear a panel from old drawing[
^],
draw a rectangle in C#[
^],
Append a picture within picturebox[
^].
For more detail, please see:
Drawing Lines between mdi child forms[
^],
capture the drawing on a panel[
^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[
^],
How to speed up my vb.net application?[
^].
As I say, if you really need to draw something point-by-point with many points, you still should better draw on a bitmap (a bitmap, not
PictureBox!), and then draw it, if you need, using
System.Drawing.Graphics.DrawImage
. Note that in this case you should not use double buffering, at least is the situation where this bitmap is all you draw.
—SA