private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Font font = new Font("Arial", 8, FontStyle.Regular);
//e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
//e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
e.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
// e.SmoothingMode = SmoothingMode.AntiAlias;
// e.InterpolationMode = InterpolationMode.HighQualityBicubic;
//e.PixelOffsetMode = PixelOffsetMode.HighQuality;
e.Graphics.DrawString("FIRST NAME" , myFont, Brushes.Black, 15, 90);
e.Graphics.DrawString("MIDDLE NAME", font, Brushes.Black, 15, 105);
e.Graphics.DrawString("LASTNAME", font, Brushes.Black, 15, 120);
e.Graphics.DrawString("ADDRESS", font, Brushes.Black, 15, 135);
e.Graphics.Flush();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
float x = 0;
float y = 0;
//SolidBrush myBrush = new SolidBrush(Color.Black);
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
e.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
Bitmap bmp = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
this.pictureBox1.DrawToBitmap(bmp, new Rectangle(0, 0, this.pictureBox1.Width, this.pictureBox1.Height));
e.Graphics.DrawImage((Image)bmp, x, y);
}
打印图片框图像时,
打印字体字不清晰。 我希望在打印图像时可以看到清晰的字体(如微软字或excel打印)字母。 意味着好像素 有人建议我吗?