我刚刚开始编写这个小 C# 程序,目的无关紧要。现在它尝试制作整个屏幕的屏幕截图,它成功了......有点......
问题是我正在以 200% 缩放运行 Windows(不,我的视力不差),当我运行此代码时,我只保存了 1/4 的屏幕(左上部分),而不是预期的全部. 我非常确定这与 200% 缩放有关,我想问是否有人可以提出解决方法,以便它实际上捕获我的整个屏幕。这是代码:
string savePath = @"C:\Users\eltaro\Desktop\ScreenShot "+DateTime.Now.ToString("yyyy-MM-dd")+" at "+DateTime.Now.ToString("HH.mm")+".bmp";
bmpImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
gfxScreenshot = Graphics.FromImage(bmpImage);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0,
Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bmpImage.Save(savePath, System.Drawing.Imaging.ImageFormat.Bmp);