C#中如何实现打印listbox中的内容
有个打印按钮,点击打印,怎么样将listbox中的内容打印出来,是否能给个例子程序?
------解决方案--------------------
protected void printDocument_PrintPage(Object sender, PrintPageEventArgs e)
{
private float y=1;
private float x=1;
Font btfont = new Font("黑体", 10);
SizeF size = e.Graphics.MeasureString("样", btfont);
for (int i = 0; i < listBox1.Items.Count; i++)
{
e.Graphics.DrawString("=============客户A信息=========== ", btfont, Brushes.Black, x,y)
y += size.Height;
e.Graphics.DrawString(listBox1.Items[i].ToString(), btfont, Brushes.Black, x,y)
}
}
自已调整x,y的值
------解决方案--------------------
试一下:
C# code
protected void printDocument_PrintPage(Object sender, PrintPageEventArgs e)
{
private float y=1;
private float x=1;
Font btfont = new Font("黑体", 10);
SizeF size = e.Graphics.MeasureString("样", btfont);
for (int i = 0; i < listBox1.Items.Count; i++)
{
e.Graphics.DrawString("=============客户A信息=========== ", btfont, Brushes.Black, x,y)
y += size.Height;
e.Graphics.DrawString(listBox1.Items[i].ToString(), btfont, Brushes.Black, x,y)
}
}