public void OnMouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { using (Graphics g = Graphics.FromImage(PictureBox.Image)) { Pen pen = new Pen(GlobalProperties.ContainsKey("Color") ? ColorTranslator.FromHtml(GlobalProperties["Color"]) : Color.Black); _currentModification.AddPoint(e.Location, pen); g.DrawLine(pen, _previousPoint, e.Location); } _previousPoint = e.Location; PictureBox.Invalidate(); } }
public void OnMouseUp(object sender, MouseEventArgs e) { _currentModification.AddPoint(e.Location, _pen); Modifications.Add(_currentModification); _currentModification = null; }