【发布时间】:2018-05-12 04:46:01
【问题描述】:
我正在尝试打印一个长列表,首先我测量了字符串,并通过它防止从页面左侧溢出,但是我无法在页面末尾执行此操作。它没有通过下一页。我该怎么做 ?代码:
private void button27_Click(object sender, EventArgs e)
{
listele();
printDialog1.Document = printDocument1;
if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font printFont = new Font("Arial", 10);
Graphics gf = e.Graphics;
SizeF sf = gf.MeasureString(textBox1.Text,printFont, 320);
gf.DrawString(textBox1.Text, printFont, Brushes.Black,new RectangleF(new Point(60, 60), sf),StringFormat.GenericTypographic);
}
我添加了一个屏幕截图以便更好地理解。谢谢SS1
【问题讨论】:
-
您尝试将文本打印为图片是否有原因?使用适当的工具来完成这项工作,你不会有任何问题。一个不错的选择是使用报告。
-
不,没有任何原因,只是那是我的第一次打印体验 :) 我试图了解发生了什么 :)
标签: c# database visual-studio printing