2
private void PrintTextBox(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawString(textBox1.Text, textBox1.Font, Brushes.Black, 50, 20);
}
private void printListButton_Click(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += PrintTextBox;
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = pd;
ppd.ShowDialog();
}
我嘗試了PrintTextBox
方法使用e.HasMorePages == true
,但隨後它不斷開始添加頁面。你有什麼想法如何解決它?從文本框中打印多個頁面
UpdatemŸ問題一點,你可以檢查什麼的還是錯的? –
問題在於,當您調用e.hasmorapages = true時,您的'i'重新啓動;你必須這樣做:(我更新了你的代碼)。請嘗試它並發表評論 –
它仍然只打印一頁。 –