我有一個打印預覽,顯示窗體上的捕獲面板'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