【发布时间】:2012-10-27 20:00:25
【问题描述】:
我正在尝试在我的主显示器上打印(显示在屏幕上)屏幕截图,我想我已经拥有了实现这一目标的所有必要变量,但我不知道如何通过“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:这是我第一次使用这个网站,所以请原谅我可能犯的任何愚蠢的错误
【问题讨论】:
-
@Mohsen Afshin 屏幕上没有打印 只显示图像
-
您想要 1) 创建您的应用程序的屏幕截图并将其显示在桌面上(如墙纸)还是 2) 创建您的桌面屏幕截图并将其显示在您的应用程序中。
-
我想截取我的主显示器的屏幕截图(以这种特定方式)并查看它……就是这样。我想我拥有组装一张照片所需的所有数据。不是吗?