0

我的 c# 应用程序有问题,因为我需要像 VB6 那样使用 X 和 Y 位置坐标使用点阵打印机“Olivetti PR2 Plus”进行打印。问题是如果字符串大约有 20 多个字符,打印机速度很慢,我需要快速打印。

我有以下代码用于测试目的并且有问题。

private void btnPrint_Click(object sender, EventArgs e)
    {
        Document = new PrintDocument();            
        Document.PrintPage += Document_PrintPage;
        Document.PrinterSettings.PrinterName = ((ICollection)PrinterSettings.InstalledPrinters).OfType<string>().Where(p => p.ToUpper().Contains("OLIVETTI")).First().ToString();        
        Document.Print();
    }

private void Document_PrintPage(object sender, PrintPageEventArgs e)
        {
            e.Graphics.DrawString("asdfasdfasdfasdasdffasdfasdfasdf", new Font("Consolas", 8), Brushes.Black, 20, 0, new StringFormat());
            e.Graphics.DrawString("asdfasdfasdasdaasdfsdfffasdfasdf", new Font("Consolas", 8), Brushes.Black, 20, 10, new StringFormat());
            e.Graphics.DrawString("asdfasdfaasdfsasdfsadfdfasdfasdf", new Font("Consolas", 8), Brushes.Black, 20, 20, new StringFormat());
            e.Graphics.DrawString("asfdasdfsadfasasdfasdfdasdfasdff", new Font("Consolas", 8), Brushes.Black, 20, 30, new StringFormat());
            e.Graphics.DrawString("asfdasdsdafasadfsasdfdasdfasdfff", new Font("Consolas", 8), Brushes.Black, 20, 40, new StringFormat());
            e.Graphics.DrawString("asdfaasdsadfsadffsadfsdassadfdff", new Font("Consolas", 8), Brushes.Black, 20, 50, new StringFormat());
            e.Graphics.DrawString("asfdasdfsdafsadfsadfasasasdfdfdf", new Font("Consolas", 8), Brushes.Black, 20, 60, new StringFormat());
            e.Graphics.DrawString("asdfasadfassadfdfssadfassadfdfdf", new Font("Consolas", 8), Brushes.Black, 20, 70, new StringFormat());
            e.Graphics.DrawString("asfdasadfasadfsdfssadasasdffdfdf", new Font("Consolas", 8), Brushes.Black, 20, 80, new StringFormat());   
        }

我无法在 RAW“DOS”模式下打印,因为要打印的数据源具有与纸张格式匹配的特定坐标。¿ 有什么提高打印机性能的建议吗?

4

0 回答 0