文件名称:wpf 简单的截图代码
文件大小:124KB
文件格式:ZIP
更新时间:2015-04-09 05:29:30
wpf 截图
图片截取和保存 private BitmapSource CreateElementScreenshot(Visual visual, int width, int height) { RenderTargetBitmap bmp = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Default); bmp.Render(visual); return bmp; } private VisualBrush SaveImageSource(double width, double height, double x, double y) { Image img = new Image(); img.Source = CreateElementScreenshot(parentCanvas, Convert.ToInt32(Wwidth), Convert.ToInt32(Wheight)); img.Width = Wwidth; img.Height = Wheight; //img.Stretch = Stretch.Fill; Rect r1 = new Rect(x, y, width, height); img.Clip = new RectangleGeometry(r1); VisualBrush vb = new VisualBrush(img); return vb; }
【文件预览】:
截图
----Screenshot()
--------Screenshot()
--------Screenshot.suo(25KB)
--------Screenshot.sln(872B)