manuel

manuel

  • NA
  • 68
  • 0

merge 2 images side by side inted of capture screen

Apr 15 2018 5:41 AM
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;

 

Answers (2)