hi is there onother way to save pictureBox1+pictureBox2 side by side instead of taking snapshot?
int x = 10; // Where inside the form do you want to take a snapshot
int y = 35; // Where inside the form do you want to take a snapshot
int width = 470; // width of snapshot
int height = 385; // height of snapshot
int formLocX = this.Location.X; // Where is the form on the desktop?
int formLocY = this.Location.Y; // Where is the form on the desktop?
int offsetX = this.Size.Width - this.DisplayRectangle.Width; // this is the offset, i.e. the border
int offsetY = this.Size.Height - this.DisplayRectangle.Height; // this is the offset, i.e. the border
x = x + formLocX + offsetX; // Add where you want the screenshot taken with its location and the offset
y = y + formLocY + offsetY; // Add where you want the screenshot taken with its location and the offset
Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(x, y, 0, 0, bmp.Size, CopyPixelOperation.SourceCopy);
pictureBox1.Image = bmp;
int y = 35; // Where inside the form do you want to take a snapshot
int width = 470; // width of snapshot
int height = 385; // height of snapshot
int formLocX = this.Location.X; // Where is the form on the desktop?
int formLocY = this.Location.Y; // Where is the form on the desktop?
int offsetX = this.Size.Width - this.DisplayRectangle.Width; // this is the offset, i.e. the border
int offsetY = this.Size.Height - this.DisplayRectangle.Height; // this is the offset, i.e. the border
x = x + formLocX + offsetX; // Add where you want the screenshot taken with its location and the offset
y = y + formLocY + offsetY; // Add where you want the screenshot taken with its location and the offset
Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(x, y, 0, 0, bmp.Size, CopyPixelOperation.SourceCopy);
pictureBox1.Image = bmp;
Maen BadwanPosted Apr 26, 2018, 3:44 AM
The best solution would be merging the two images into one larger third image and show it inside a PictureBox control.
The following thread suggests useful ways to handle merging images using C#:
https://www.c-sharpcorner.com/forums/how-to-show-multiple-image-in-picture-box
manuelPosted Apr 26, 2018, 4:20 AM