I have two questions:
1) I have a PictureBox
and its Dock is set to Fill. When I resize the Form
I cannot create a Graphic on the part of the PictureBox
that is extended. What is the problem?
2) I want to convert the Graphic that is created on the PictureBox
to Bitmap
and save it as
*.JPG or *.bmp. How can I do this?
you can use the handle device to get the bitmap out of the picture box
Graphics g = pictureBox1.CreateGraphics();
Bitmap bitMap = Bitmap.FromHbitmap(g.GetHdc());
bitMap.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
or even better, if the pictureBox does`nt modify the image, you can directly get the image from the pictureBox control
pictureBox1.Image.Save("path", System.Drawing.Imaging.ImageFormat.Jpeg);