Drucken eines Panel-Control

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hallo,
auf einem Panel zeichne ich verschiedene Figuren, die ich dann drucken will.
Die 'gedruckte' Seite bleibt jedoch leer.
..
Panel panel;

private panel_Paint(Object sender, PaintEventArgs pea)
{
Graphics g = this.panel.CreateGraphics();
g.DrawLine(..);
...
}

protected void menuFilePrint_Click(Object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
DialogResult result;

PageSetupDialog pageSetupDialog = new PageSetupDialog();
pageSetupDialog.Document = this.printDocument;
pageSetupDialog.PageSettings.Landscape = true;
pageSetupDialog.PageSettings.Margins.Left = 100;
pageSetupDialog.PageSettings.Margins.Right = 100;
pageSetupDialog.PageSettings.Margins.Top = 200;
pageSetupDialog.PageSettings.Margins.Bottom =100;
result = pageSetupDialog.ShowDialog();
if (result != DialogResult.OK) return;

PrintDialog printDialog = new PrintDialog();
printDialog.Document = pd;
pd.OriginAtMargins = true;
result = printDialog.ShowDialog();
if (result == DialogResult.OK) pd.Print();
}

private void pd_PrintPage(object sender, PrintPageEventArgs ppea)
{
PaintEventArgs pea = new PaintEventArgs(ppea.Graphics, new
Rectangle(new Point (20, 30), this.Size));
this.InvokePaint(this.panel, pea);
}

Das Blatt bleibt leer. Was mache ich falsch?

Mit freundlichem Gruß und auf einen helfenden Hinweis hoffend
Horst Artner


.



Relevant Pages

  • Re: Drucken eines Panel-Control
    ... auf einem Panel zeichne ich verschiedene Figuren, ... private panel_Paint(Object sender, PaintEventArgs pea) { ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Drawing on a panel
    ... private void panel1_Paint(object sender, PaintEventArgs e) ... Where a panel is on a form. ...
    (microsoft.public.dotnet.languages.csharp)
  • TranslateTransform
    ... Why does the following code give me a g.ClipRectangle which is infinite? ... private void ih_Paint(object sender, PaintEventArgs e) { ... But on a panel, it gives me an infinitely large rectangle! ...
    (microsoft.public.dotnet.languages.csharp)
  • Simple? Form Design Question
    ... the visiblechanged property of a particular panel. ... private void toolStripButton1_Click(object sender, EventArgs ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: PPC flicker problem.
    ... the picture in the panel should also move following the mouse... ... I use the Bitblt, but it doesn't work. ... private void panelMap_MouseMove(object sender, ...
    (microsoft.public.pocketpc.developer)