Das ist mein kompletter code:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20:
| private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) { Font printFont = new Font("Arial", 18, FontStyle.Bold); e.Graphics.DrawString("Dies ist ein Ausdruck", printFont, Brushes.Black, 25, 25); }
private void button11_Click(object sender, EventArgs e) { PrintDocument printDocument1 = new PrintDocument(); printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage); PrintDialog printDialog1 = new PrintDialog(); printDialog1.Document = printDocument1; if (printDialog1.ShowDialog() == DialogResult.OK) { printDocument1.Print(); } } |
interessanterweise wenn ich den ShowDialog() nicht aufrufe sondern direkt printDocument1.Print();
wirft der Drucker eine absolut leere Seite aus.
Hab ich evtl. vergesse noch was zu implementieren?
@Ralf Jansen:
wo soll ich das 'UseEXDialog' einfügen ?
Moderiert von
Narses: C#-Tags hinzugefügt