title: Line draw next to mouse
body: <p>I'm trying to make an app to edit images. I've struggled with saving my graphics drawn on an image for a while and I've got that fixed now, but my next problem is that the lines now appear a few pixels away from the mouse position.</p>
  
  <p>I have this:</p>
  
  <pre><code>bool draw = false;
  Graphics g;
  int? preX = null;
  int? preY = null;
  
  private void btnOpen_Click(object sender, EventArgs e)
  {
      OpenFileDialog open = new OpenFileDialog();
      open.Filter = "Image Files(*.jpg; *.jpeg; *.bmp; *.png;)|*.jpg; *.jpeg; *.bmp; *.png;";
  
      if (open.ShowDialog() == DialogResult.OK)
      {
          pictureBox1.Image = new Bitmap(open.FileName);
      }
  }
  
  private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
  {
      if (draw)
      {    
          Pen pen = new Pen(btnColor.ForeColor, float.Parse(numericUpDown1.Value.ToString()));
          Graphics g = Graphics.FromImage(pictureBox1.Image);
          g.DrawLine(pen, new Point(preX ?? e.X, preY ?? e.Y), new Point(e.X, e.Y));
          preX = e.X;
          preY = e.Y;
          pictureBox1.Invalidate();
      }
  }
  </code></pre>
  
  <p>I hope this makes sense, otherwise I will try to make things clearer. I don't really understand why this happens but when i start drawing on the picturebox the line doesn't appear at the mouse pointer, but a few pixels to the right. pls help :(</p>