Bild aus einer ImagBox drucken

meste

Erfahrenes Mitglied
Hallo!

Wie der Title schon sagt möchte ich aus einer ImagBox ein Bild drucken.
Ich pversuche es mit
Code:
        Dim doc As New PrintDocument
        doc.DocumentName = imbPlan.ImageUrl

        Dim dialog As New PrintDialog
        dialog.Document = doc
        doc.Print()
aber da bekomme ich eine leere Seiteraus.
Doch wenn ich das mit DialogResult usw. amche bekomme ich die Meldung
Das Anzeigen eines modalen Dialogfelds oder eines Formulars ist nicht zulässig, wenn die Anwendung nicht im UserInteractive-Modus ausgeführt wird. Geben Sie das Format ServiceNotification oder DefaultDesktopOnly an, um Benachrichtigungen einer Dienstanwendung anzuzeigen.
Kann mir jemand bitte in ganz einfachen Schritten zeigen bzw. sagen, welche Schritte zum Erfolg führen. Ich habe auch schon gesucht aber leider nichts für mich gefunden.

Ich danke schon im vorhinein

m.e.s.t.e.
 
So in etwa:
Code:
Printing.PrintDocument pd;
Bitmap imagetoprint;

private void Print() 
{
  pd = new Printing.PrintDocumet();
  pd.PrintPage += this.printpage;
  this.imagetoprint = this.pictureBox1.Image;
this.pd.Print();
}

private void printpage(Object o, System.Drawing.Printing.PrintPageEventArgs e)
{
   e.Graphics.DrawImage(imagetoprint, 0, 0,500,500); 
}
 

Neue Beiträge

Zurück