this is a screenshot of my form1 and there is a small offset between the point and the mouse cursor. the point should be drawn where the mouse cursor arrow is.
if for example i click with the mouse inside the picturebox top left corner at 0,0 i should see half of point but i see the completed point because that offset between the point and the mouse cursor. the drawing is not accurate.
the form1 code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mouse_Click_Test
{
public partial class Form1 : Form
{
int x, y;
public Form1()
{
InitializeComponent();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawEllipse(Pens.Red, x, y, 20, 20);
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
this.x = e.X;
this.y = e.Y;
pictureBox1.Invalidate();
}
}
}