用printdocument就可以,用PrintPageEventArgs.HasMorePages 属性 指定是否打印新的一页,可以参见下面的用法:// Specifies what happens when the user clicks the Button. private void printButton_Click(object sender, EventArgs e) { try { // Assumes the default printer. PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage); pd.Print(); } catch(Exception ex) { MessageBox.Show("An error occurred while printing", ex.ToString()); } }
// Specifies what happens when the PrintPage event is raised. private void pd_PrintPage(object sender, PrintPageEventArgs ev) { // Draw a picture. ev.Graphics.DrawImage(Image.FromFile("C:\\My Folder\\MyFile.bmp"), ev.Graphics.VisibleClipBounds);
// Indicate that this is the last page to print. ev.HasMorePages = false; }
如果固定要一行打印一页的话有简单的办法。 http://babyt.cnblogs.com/archive/2005/03/11/116907.html 他这里写了,把:recurdnumber mod 10 = 0 改成 recurdnumber mod 1 = 0 就行了,mod后边的数意思是每页显示的行数
http://hi.baidu.com/webprince/blog/item/2810b199e0dd58086f068c75.html
C/S同样适用,2005也适用。
private void printButton_Click(object sender, EventArgs e)
{
try
{
// Assumes the default printer.
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
}
catch(Exception ex)
{
MessageBox.Show("An error occurred while printing", ex.ToString());
}
}
// Specifies what happens when the PrintPage event is raised.
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
// Draw a picture.
ev.Graphics.DrawImage(Image.FromFile("C:\\My Folder\\MyFile.bmp"), ev.Graphics.VisibleClipBounds);
// Indicate that this is the last page to print.
ev.HasMorePages = false;
}
http://babyt.cnblogs.com/archive/2005/03/11/116907.html
他这里写了,把:recurdnumber mod 10 = 0 改成 recurdnumber mod 1 = 0
就行了,mod后边的数意思是每页显示的行数
http://babyt.cnblogs.com/archive/2005/03/11/116907.html
他这里写了,把:recurdnumber mod 10 = 0 改成 recurdnumber mod 1 = 0
就行了,mod后边的数意思是每页显示的行数
-------------------------
看不懂?