I have a big problem when I convert my PictureBox to bitmap with labels to save it in my computer, it appears moved and with a really low resolution, I'm a newbie so... I really don't know how to fix it
here is my code to save it:
System.Drawing.Point pbloc = pictureBox1.PointToScreen(pictureBox1.Location);
Bitmap bm = new Bitmap(pictureBox1.Size.Width, pictureBox1.Size.Height);
Graphics grx = Graphics.FromImage(bm);
grx.CopyFromScreen(pbloc.X, pbloc.Y, 0, 0, pictureBox1.Size, CopyPixelOperation.SourceCopy);
grx.Dispose();
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "JPG(*.JPG)|*.jpg";
if (sfd.ShowDialog() == DialogResult.OK)
{
bm.Save(sfd.FileName,
System.Drawing.Imaging.ImageFormat.Jpeg);
}
I used this to parent the labels with the PictureBox:
public Registro()
{
InitializeComponent();
var pos1 = this.PointToScreen(label1.Location);
pos1 = pictureBox1.PointToClient(pos1);
this.label1.Parent = this.pictureBox1;
label1.Location = pos1;