在做项目时,需要打印窗体上指定某部分的内容,现将代码分享如下。
首先要知道API
//调入外部的非托管代码,使用从gdi32.dll库导入的函数BitBlt,使用Windows GDI。
[DllImport(“gdi32.dll”)]
Public static extern long BitBlt(IntPtr hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,IntPtr hdcSrc,int nXSrc,int nYSrc,int