我想获取应用程序主窗体的屏幕截图。我使用以下代码实现:
Bitmap bitmap = new Bitmap(MainForm.Width, MainForm.Height);
DrawToBitmap(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
pictureBox1.Image = bitmap;
我在主窗体中有一些用户控件。使用上面的代码,我只能获取主窗体的截图,无法获取用户控件的截图。
请问有没有人可以建议我如何获得包含用户控件的 Windows 窗体的截图?
Control.DrawToBitmap()
。 - Fabjan