private void PictureBoxPoints_Paint(object sender, PaintEventArgs e)
{
if (pictureBoxPoints.Image != null)
{
Bitmap bitmap = pictureBoxPoints.Image as Bitmap;
double xFactor = (double)bitmap.Width / pictureBoxPoints.Width;
double yFactor = (double)bitmap.Height / pictureBoxPoints.Height;
double scaleFactor = Math.Max(xFactor, yFactor); // Ensure uniform scaling
foreach (System.Drawing.Point point in _dotPoints)
{
int ellipseSize = (int)(5 / scaleFactor); // Ensure uniform scaling for the size
int ellipseX = (int)(point.X / scaleFactor) - ellipseSize / 2;
int ellipseY = (int)(point.Y / scaleFactor) - ellipseSize / 2;
e.Graphics.FillEllipse(Brushes.Red, new Rectangle(ellipseX, ellipseY, ellipseSize, ellipseSize));
}
}
}