2016-12-01 71 views
0

我在製作c# WPF應用程序。此應用程序的一部分涉及用戶在屏幕上移動項目。要做到這一點,每個項目都有自己的ContentControl,它的工作非常好。將C#ContentControl映射到位圖

然而,我現在需要將這些內容控制器的內容輸出到bitmap

我創建的

Bitmap = new Bitmap(width, height) 

位圖,但我怎麼添加的內容控制輸出?

+1

http://stackoverflow.com/questions/20683542/how-do-i-convert-a-wpf-window-to - 位圖? – BugFinder

回答

0

您可以使用capturescreen到當前窗口轉換爲圖像:

ScreenCapture sc = new ScreenCapture(); 
// capture entire screen, and save it to a file 
Image img = sc.CaptureScreen(); 
Bitmap = new Bitmap(img)