【发布时间】:2017-08-24 23:22:06
【问题描述】:
我正在尝试获取一个长描述以适合我的 printPreviewDialog 文档。但是,当我在文本框中键入描述并尝试打印时,文本不会保留在文档上。 Text not staying on document导致此问题的代码行是最后一行
e.Graphics.DrawString("Description:" + description4Repair.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 493));
所有代码:
e.Graphics.DrawString("DEVICE INFORMATION:", new Font("Arial", 14, FontStyle.Regular), Brushes.Black, new Point(286, 373));
e.Graphics.DrawString("Device Type:" + devices.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 403));
if (devices.Visible == true & devices.Text == "Console")
{
e.Graphics.DrawString("Type of Console:" + consoleTextBox.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 433));
}
if (comboBox3.Visible == true) //iphone selection box is visible then show selected model on print document
{
e.Graphics.DrawString("Type of Phone:" + comboBox3.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 433));
e.Graphics.DrawString("Service Type:" + serviceDesc.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 463));
e.Graphics.DrawString("Description:" + description4Repair.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 493));
```
【问题讨论】:
-
您需要按照Drawstring word wrap or display entire text中的说明包装您的文本
标签: c# winforms printing print-preview