private void PageImage_MouseUp(object sender, MouseEventArgs e){ if (e.Button == MouseButtons.Left) { isDrawing = false; //MemoryStream ms = new MemoryStream(); pageImage.Image?.Dispose(); drawingBitmap.Save("C:\\test.png"); //pageImage.ImageLocation); }}
private void PageImage_MouseDown(object sender, MouseEventArgs e){ if (e.Button == MouseButtons.Left) { isDrawing = true; pos.X = e.X; pos.Y = e.Y; }}private void PageImage_MouseDrawMove(object sender, MouseEventArgs e){ if (isDrawing) { g.DrawLine(drawingPen, pos, e.Location); pos = e.Location; pageImage.Invalidate(); }}private void PageImage_MouseUp(object sender, MouseEventArgs e){ if (e.Button == MouseButtons.Left) { isDrawing = false; drawingBitmap.Save(pageImage.ImageLocation); }}
drawingBitmap = new Bitmap(pageImage.ImageLocation);//g = pageImage.CreateGraphics();g = Graphics.FromImage(drawingBitmap);pageImage.Image = drawingBitmap;