【发布时间】:2015-08-11 14:25:28
【问题描述】:
如何打印出整个字符串? 我想知道如何用换行符打印出这个字符串?
谢谢你的回答
private void drucken_Click(object sender, EventArgs e)
{
PrintDialog printDialog = new PrintDialog();
PrintDocument printDocument = new PrintDocument();
printDialog.Document = printDocument;
printDocument.PrintPage += new PrintPageEventHandler (PrintReceiptPage);
DialogResult result = printDialog.ShowDialog();
if (result == DialogResult.OK)
{
printDocument.Print();
}
}
private void PrintReceiptPage(object sender, PrintPageEventArgs e)
{
string message = "Haalloodhsak dfsdfsfdsfsdfdssdddddddddddddddsf Tetsn dfgdfgdfgdfg dfgdfgdfgdfg dfgdfgdfgdfggdfdfg gdgdgdffgddfgdfgdfggdf dfgdfgdfgdfggdf";
int y;
// Print receipt
Font myFont = new Font("Times New Roman", 15, FontStyle.Bold);
y = e.MarginBounds.Y;
e.Graphics.DrawString(message , myFont, Brushes.Red, e.MarginBounds.X, y);
}
【问题讨论】:
-
我确定您的意思是要将其包装到页面的宽度?