I have a PictureBox on a form.
In Load event of the form I create graphics as follows:
imageGraphics = Graphics.FromImage(PictureBox1.Image)
Then, in PictureBox_MouseMove event I draw ellipse:
imageGraphics.FillEllipse(New SolidBrush(brushColor), e.X, e.Y, brushWidth, brushWidth)
No matter what I try, it always draws on incorrect coordinates. I tried e.Location.PointToClient(), PointToScreen(), and Cursor.Position. All far from expected (I need to draw exactly where the cursor is).
Whenever form is resized (and PictureBox, too, as it's Anchor property is set to expand), relative position of drawing to cursor changes.
Is there anything I'm missing?