2013-01-25 44 views

回答

2

不幸的是,在c#中没有这样的功能。 请尝试以下代码:

try 
{ 

// initialize D3D device 
PresentParameters presentParams = new PresentParameters(); 
presentParams.Windowed = true; 
presentParams.SwapEffect = SwapEffect.Discard; 
Device myDevice = new 
Device(0,DeviceType.Hardware,this,CreateFlags.SoftwareVertexProcessing,presentParams); 

// create a surface the size of screen, 
// format had to be A8R8G8B8, as the GetFrontBufferData returns 
// only memory pool types allowed are Pool.Scratch or Pool.System memory 
Surface mySurface = 
myDevice.CreateOffscreenPlainSurface(SystemInformation.PrimaryMonitorSize.Width,SystemInformation.PrimaryMonitorSize.Height,Format.A8R8G8B8,Pool.SystemMemory); 

//Get the front buffer. 
myDevice.GetFrontBufferData(0,mySurface); 

//saves surface to file 
SurfaceLoader.Save("surface.bmp",ImageFileFormat.Bmp,mySurface); 

} 
catch 
{ 
    //whatever 
} 
+0

感谢您的帮助。但是我怎么才能让表面不是像这样的整个屏幕 – user1369825

+0

你不能。你唯一的选择是从完整的截图中删除所需的部分。 – Flot2011

+0

我可以旋转模型并将其创建为avi文件吗? – user1369825