c# - Printing a pictureBox in a MdiChild -
i'm trying print content of picturebox in mdichild. debugging code looks never triggers printpage event. i've used code project: printing content of picturebox
what wrong ?
here code:
private void stampatoolstripmenuitem_click(object sender, eventargs e) { form2 activechild = this.activemdichild form2; picturebox thebox = (picturebox)activechild.picturebox1; dastampare = thebox.image bitmap; printdocument1.originatmargins = true; printdocument1.documentname = "prova"; printdialog1.document = printdocument1; printdialog1.showdialog(); if (printdialog1.showdialog() == dialogresult.ok) { printdocument1.print(); } } private void printdocument1_printpage(object sender, system.drawing.printing.printpageeventargs e) { e.graphics.drawimage(dastampare, 0, 0); }
in form's constructor, seek wiring eventhandler:
public form1() { initializecomponent(); printdocument1.printpage += printdocument1_printpage; }
c# printing picturebox mdichild
No comments:
Post a Comment