在C#中使用Win Form打印时如何增加文本的暗度

时间:2015-07-19 05:25:05

标签: c# .net winforms printdocument drawingbrush

我正在尝试用C#打印文档。但是,文字的黑色不好。它很暗淡。如何调整文本颜色的质量以使其更暗更清晰? 这是我的代码:

 Font font = new Font("Courier New", 18);
 SolidBrush brush = new SolidBrush(Color.Black);

 graphic.DrawString(DateTime.Now.ToString("dd/MM/yy"), font, brush,10,10);

任何帮助表示赞赏!谢谢!

2 个答案:

答案 0 :(得分:1)

不使用 Courier New ,而是使用其他字体,例如 Arial Black Copperplate Gothic Bold

答案 1 :(得分:1)

//for more clearer rendering of text use
graphic.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

//for darker font use BOLD font style
Font font = new Font("Courier New", 18,FontStyle.Bold);

所以你的代码变成了

 graphic.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
 Font font = new Font("Courier New", 18,FontStyle.Bold);
 SolidBrush brush = new SolidBrush(Color.Black);

 graphic.DrawString(DateTime.Now.ToString("dd/MM/yy"), font, brush,10,10);