gpt4 book ai didi

c# - 我如何从 C# 打印点阵字体的文本?

转载 作者:太空宇宙 更新时间:2023-11-03 15:50:59 25 4
gpt4 key购买 nike

此代码运行良好,但该代码以简单字体打印文本,但我想以点阵字体打印它,是否有任何代码以点阵字体打印它?

try
{

PrintDocument pd = new PrintDocument();

pd.DefaultPageSettings.PaperSize = new PaperSize("A4", 827, 1170);

pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);

pd.Print();

}
catch (Exception ex)
{
MessageBox.Show("پیج کو پرنٹ کرتےوقت ایرر آگیا", ex.ToString());
}
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawString(textBox1.Text.ToString(), new Font("BroadWay", 18,
FontStyle.Bold), Brushes.Black, 14,95);
e.Graphics.DrawString(textBox2.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 12, 165);
e.Graphics.DrawString(textBox3.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 12, 265);
e.Graphics.DrawString(textBox4.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 346, 96);
e.Graphics.DrawString(textBox5.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 285, 165);
e.Graphics.DrawString(textBox6.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 285, 229);
e.Graphics.DrawString(textBox7.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 285, 287);
e.Graphics.DrawString(textBox8.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 146, 326);
e.Graphics.DrawString(textBox9.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 742, 96);
e.Graphics.DrawString(textBox10.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 634, 144);
e.Graphics.DrawString(textBox11.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 634, 215);
e.Graphics.DrawString(textBox12.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 634, 266);
e.Graphics.DrawString(textBox13.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 238, 382);
e.Graphics.DrawString(textBox14.Text.ToString(), new Font("BroadWay", 12, FontStyle.Regular), Brushes.Black, 388, 421);

}

代码运行良好,但我现在只想以点阵字体打印它 那还没有完成。我希望你们中的一个能帮助我我的打印机是 LX-300+ II 冲击式打印机我现在不知道该怎么办!

最佳答案

我没有使用阿拉伯语(或其他任何语言)的经验,但只需将字体设置为“Courier New”通常即可解决该问题。您可能需要将文本编码从 unicode 转换为 ansi。

关于c# - 我如何从 C# 打印点阵字体的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25820791/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com