问题
I watched and applied these video tutorials on my program:
Camera Capture using AForge - https://youtu.be/_1GymNPQ248
Drawing Pad - https://youtu.be/TVPHEIJX-uw
I used picturebox both on them and can't save files using SaveFileDialog.
Using Graphics G = picturebox1.CreateGraphics()
is temp (How to draw on a picturebox and save it in Winforms C#?)
I just want to have permanent image of them and save. Hoping you could help me, friends. Here's my code:
private void xpt_SnS_Click(object sender, EventArgs e)
{
SaveFileDialog sav = new SaveFileDialog();`
if (sav.ShowDialog() == DialogResult.OK)
{
picbx_Main.Image = imgCam;
imgCam.Save(sav.FileName);
}
}
//int w = pan_sign2.Size.Width;
//int h = pan_sign2.Size.Height;
//using (Bitmap bmp = new Bitmap(w,h))
//{
// pan_sign2.DrawToBitmap(bmp, new Rectangle(0,0,w,h));
// bmp.Save("Test.jpg");
//}
//Bitmap bmp = new Bitmap(pan_sign2.Width, pan_sign2.Height);
//var gg = Graphics.FromImage(bmp);
//var rect = pan_sign2.RectangleToScreen(pan_sign2.ClientRectangle);
//gg.CopyFromScreen(rect.Location, System.Drawing.Point.Empty, pan_sign2.Size);
//System.Diagnostics.Process.Start("Test.jpg");
//pan_sign2.Image = imgSign;
//SaveFileDialog sav = new SaveFileDialog();
//sav.Filter = "JPEG |*.jpg";
//if (sav.ShowDialog() == DialogResult.OK)
//{
// imgSign.Save(sav.FileName);
//}
来源:https://stackoverflow.com/questions/65762544/saving-camera-shot-and-drawing-from-picturebox-to-jpeg