C#获取表单flash内容的截图[复制]

问题描述 投票:1回答:1

这个问题在这里已有答案:

编辑:我尝试clientRectangle但我从桌面的左上角获取图像而不是表单!我尝试获取我的表单的屏幕截图,其中有一个flash动画。所以我试试这个:

Rectangle bounds = this.Bounds;
Bitmap bitmap = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(bitmap);

g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
bitmap.Save("C:/Users/Public/Documents/YouCam/flash.jpeg", ImageFormat.Jpeg);
MessageBox.Show("Save");

它工作,但我也得到了形式的边界。如何在没有控制栏和边框的情况下获取表单的内部?红色表示我要捕获的区域:

enter image description here

谢谢 ;)

PS:对不起,我的英语很差!

c# forms screenshot
1个回答
0
投票

你可以使用Form的方法DrawToBitmap:

        Bitmap bitmap = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
        this.DrawToBitmap(bitmap, this.ClientRectangle);
        bitmap.Save(@"C:\Deployment\test.bmp");
© www.soinside.com 2019 - 2024. All rights reserved.