c# - Printing windows form with capture screen -
i trying print windows form controls on captured screen, prints blank page. wrong? here code use:
private void outputlaundry_load(object sender, eventargs e) { out ou = new out(); ou.lst = main.laundryoutlist; ou.clientname = main.clientoutname; ou.employee = login.user.name; label2.text = datetime.today.tostring("dd.mm.yyyy"); label3.text = ou.clientname; dbc.outputlaundry(dgvout, ou.lst); label4.text = ou.employee; } private void button1_click(object sender, eventargs e) { capturescreen(); printdocument1.print(); } bitmap memoryimage; private void capturescreen() { graphics mygraphics = this.creategraphics(); 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 printdocument1_printpage(system.object sender, system.drawing.printing.printpageeventargs e) { e.graphics.drawimage(memoryimage, 0, 0); }
Comments
Post a Comment