Form ausdrucken, wie ändere ich die Skalierung per Code, damit Form auf Blatt paßt??
-
Hallo, habe den folgenden COde zum drucken einer Form erstellt. Habe aber das Problem, das ich die FOrm nicht komplett auf die DIN A4-Seite bekomme. Gibt es da noch einen Skalierfaktor codeseitig? Habe nichts gefunden.
GRuß
/// <summary> /// Drucken des Formulars /// </summary> /// <param name="sender"></param> /// <param name="e"></param> Bitmap memoryImage; private void CaptureScreen() { Graphics myGraphics = this.CreateGraphics(); myGraphics.PageUnit = GraphicsUnit.Millimeter; myGraphics.PageScale = 2; Size s = this.Size; memoryImage = new Bitmap(s.Width, s.Height, myGraphics); Graphics memoryGraphics = Graphics.FromImage(memoryImage); memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s); } private void button1_Click(object sender, EventArgs e) { CaptureScreen(); printDocument1.DefaultPageSettings.Landscape = true; printDialog1.Document = printDocument1; printDialog1.UseEXDialog = true; printDialog1.ShowDialog(); printDocument1.Print(); } private void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(memoryImage, 1, 1); } private void button2_Click(object sender, EventArgs e) { printPreviewDialog1.Document = printDocument1; if (printPreviewDialog1.ShowDialog() == DialogResult.OK) printDocument1.Print(); }
-
Schade...
-