日期:2014-05-17 浏览次数:21054 次
Image screenImg = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
using (Graphics g = Graphics.FromImage(screenImg))
{
g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);
}
using System.Runtime.InteropServices;
using DWORD = System.UInt32;
using HANDLE = System.IntPtr;
using HDC = System.IntPtr;
[DllImport("coredll.dll")]
public static extern bool BitBlt(
IntPtr hdcDest,
int nXDest,
int nYDest,
int nWidth,
int nHeight,
IntPtr hdcSrc,
int nXSrc,
int nYSrc,
System.Int32 dwRop);
public static void PickPho()
{
//IntPtr dc1 = API.CreateDC("DISPLAY", null, null, (IntPtr)null);
//创建显示器的DC
Graphics g1 = Graphics.FromHdc(dc1);
//由一个指定设备的句柄创建一个新的Graphics对象
Bitmap MyImage = new Bitmap(800, 480);