我在运行时复制图片框时遇到问题,需要屏幕相对于图片框的当前位置
在这行代码中,图片框的位置,但我需要相对于屏幕的位置。我们有什么办法吗?
// gfxScreenshot.CopyFromScreen(pictureBox1.Bounds.X, pictureBox1.Bounds.Y, 0, 0, pictureBox1.Bounds.Size, CopyPixelOperation.SourceCopy);
if (saveScreenshot.ShowDialog() == DialogResult.OK)
{
bmpScreenshot = new Bitmap(pictureBox1.Bounds.Width, pictureBox1.Bounds.Height, PixelFormat.Format32bppArgb);
gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
}