1) You need to declare "p":
Point p = new Point(e1.X, e1.Y);
2) You need to dispose of all the Graphics, and Pen objects you create - not doing that will cause problems later.
3) The start point for a Ellipse is always the top left corner: Try offseting them:
g.DrawEllipse(p3, p.X - 7, p.Y - 7, 15, 15);
From OP:
"pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;"
Now, that is relevant information!
When you use
PictureBoxSizeMode.StretchImage
you apply a transform too all graphics operations, to make them scale appropriatly into the re-sized image. You don't want that!
Instead use this:
using (Image source = Image.FromFile(@"F:\Temp\BTC.jpg"))
{
Image resized = new Bitmap(source, pictureBox1.Size);
pictureBox1.Image = resized;
}
And modify your Mouse Click event as per the suggestions above:
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
Bitmap b = (Bitmap) pictureBox1.Image;
pictureBox1.Image = b;
using (Graphics g = Graphics.FromImage(b))
{
Point p = new Point(e.X, e.Y);
using (Pen p3 = new Pen(Color.Red, 2))
{
this.Text = p.ToString();
g.DrawEllipse(p3, p.X - 7, p.Y - 7, 15, 15);
}
}
pictureBox1.Invalidate();
}
}
Seriously, not disposing of objects (particularly graphics related objects) causes unpredictable problems later on - it can be very hard to work out what the problem is if it doesn't occur until two weeks after you wrote and tested this code!