【发布时间】:2019-04-18 16:46:17
【问题描述】:
我已经成功打印了一个 windows 窗体,但是所有的文本都有些模糊。我得出的结论是,这是由于屏幕分辨率远低于打印机使用的分辨率。我的方法是否存在根本缺陷,或者有没有办法在打印之前重新格式化文本以使其清晰?
void PrintImage(object o, PrintPageEventArgs e)
{
int x = SystemInformation.WorkingArea.X;
int y = SystemInformation.WorkingArea.Y;
int width = panel1.Width;
int height = panel1.Height;
Rectangle bounds = new Rectangle(x, y, width, height);
Bitmap img = new Bitmap(width, height);
this.DrawToBitmap(img, bounds);
Point p = new Point(100, 100);
e.Graphics.DrawImage(img, p);
}
private void BtnPrint_Click(object sender, EventArgs e)
{
btnPrint.Visible = false;
btnCancel.Visible = false;
if(txtNotes.Text == "Notes:" || txtNotes.Text == "")
{
txtNotes.Visible = false;
}
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(PrintImage);
pd.Print();
}
【问题讨论】:
-
我认为你最好使用
DrawString而不是DrawImage。或许可以试试DrawString看看文字是否清晰?
标签: c# winforms printing printdocument blurry