private void PicBox_MouseUp(object sender, MouseEventArgs e) { var finish = new Point(e.X, e.Y); //для рисования var g = Graphics.FromImage(bm); var pen = new Pen(Color.Black, 5f); g.DrawLine(pen, start, finish); g.Save(); drawing = false; g.Dispose(); PicBoxAdmin.Invalidate(); }
private void PicBox_MouseMove(object sender, MouseEventArgs e) { if (!drawing) { return; //тут 3 процедуры на рисование - движение мыши, нажатая кнопка и отжатая } var finish = new Point(e.X, e.Y); bm2 = new Bitmap(bm); PicBoxAdmin.Image = bm2; var pen = new Pen(Color.Black, 5f); var g = Graphics.FromImage(bm2); g.DrawLine(pen, start, finish); g.Dispose(); PicBoxAdmin.Invalidate(); }