我试图在我的主监视器上打印(显示在屏幕上)屏幕截图,我想我已经拥有了所有必要的变量来实现这一点,但我不知道如何通过“PaintEventArgs”。我应该寄什么,我该怎么做?
编辑:这是我想做的 http://msdn.microsoft.com/en-us/library/8tda2c3c.aspx
static void Main(string[] args)
{
Rectangle rect = Screen.PrimaryScreen.Bounds;
int color = Screen.PrimaryScreen.BitsPerPixel;
PixelFormat pf;
pf = PixelFormat.Format32bppArgb;
Bitmap BM= new Bitmap(rect.Width, rect.Height, pf);
Graphics g = Graphics.FromImage(BM);
g.CopyFromScreen(rect.Left, rect.Top, 0, 0, rect.Size);
Bitmap bitamp = new Bitmap(BM);
print (bmp,) // what now?
}
private static void print(Bitmap BM, PaintEventArgs e)
{
Graphics graphicsObj = e.Graphics; // or "Bitmap bitmap = new Bitmap("Grapes.jpg");"
graphicsObj.DrawImage(BM, 60 ,10); // or "e.Graphics.DrawImage(bitmap, 60, 10);"
graphicsObj.Dispose();
}
PS:这是我第一次使用该网站,所以请原谅我可能犯的任何愚蠢的错误