윈도우 화면을 캡쳐.
private void WindowCapture(Window win)
{
RenderTargetBitmap bmp = new RenderTargetBitmap((int)win.Width, (int)win.Height, 96, 96, PixelFormats.Pbgra32);
bmp.Render(win);
string PicPath = "c:\\Screenshot\\";
if (!Directory.Exists(PicPath))
Directory.CreateDirectory(PicPath);
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmp));
string filePath = PicPath + string.Format("{0:MMddyyyyhhmmss}.png", DateTime.Now);
using (Stream stream = File.Create(filePath))
{
encoder.Save(stream);
}
}
'Development > C#' 카테고리의 다른 글
| 최상위 컨트롤 (0) | 2012.12.13 |
|---|---|
| ClickOnce 삭제 (0) | 2012.12.13 |
| 모바일 개발자가 C#을 주목해야 하는 이유 (0) | 2012.07.16 |
| COM+ 관리: 구성 요소 서비스 관리 도구 이해 (0) | 2012.03.30 |
| DependencyObject, DependencyProperty, PropertyMetadata (0) | 2012.03.15 |