我有一个打印预览,显示窗体上的捕获面板'Panel1.DrawToBitmap(memoryImage,bounds);'Winforms打印预览模糊
我也将图像保存到我的硬盘驱动器 - “memoryImage.Save(‘diary.png’)”
在任何缩放级别在打印预览中的图像是模糊的,保存的图像是完美的(看在Windows照片查看器& PS)。
像打印预览像保存的图像,任何想法一样好?
下面的代码: -
private void CaptureScreen()
{
int x = splitContainerDiary.Location.X;
int y = splitContainerDiary.Location.Y;
int SCwidth = splitContainerDiary.Panel1.Width;
int SCheight = splitContainerDiary.Panel1.Height;
Rectangle bounds = new Rectangle(x, y, SCwidth, SCheight);
memoryImage = new Bitmap(SCwidth, SCheight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
splitContainerDiary.Panel1.DrawToBitmap(memoryImage, bounds);
memoryImage.Save("diary.png");
}
private void printDocumentDiary_PrintPage(object sender, PrintPageEventArgs e)
{
CaptureScreen();
Font HeaderFont = new Font("Consolas", 16, FontStyle.Bold);
e.Graphics.DrawString(selectedYear.ToString() + " - " + name, HeaderFont, Brushes.Black, 15, 15);
e.Graphics.DrawImage(Image.FromFile("diary.png"), 5, 5);
// e.Graphics.DrawImage(memoryImage, 0, 40);
PrintDoodle(e);
}
我试图从内存(e.Graphics.DrawImage(memoryImage,0,40),并从所保存的图像“绘制图像e.Graphics.DrawImage (Image.FromFile(“diary.png”),5,5);”他们在打印预览两个模糊
我已经尝试了不同的像素格式没有快乐要么
我试图拯救。图像为BMP,JPG,PNG也没有喜悦(从文件中绘制图像时)。
我曾尝试使用BitBlt例程也具有相同的结果。
蒂诺
汉斯谢谢你的回答,不是我所希望的,但我现在明白了吧。我打印了一个12个月的datagidview日记,每个月每天都有一个单元格,所以它会花费一些工作来使用e.graphics绘图方法:-(所以我认为我现在会坚持使用模糊效果,再次感谢Thankyou,蒂诺 – 2010-10-30 14:40:33