当前位置:编程学习 > C#/ASP.NET >>

asp.net实现图片打印

asp教程.net实现图片打印
 本款图片打印功能可以实现打印,也就是自动在电脑上的打印机上打印出来哦。

private void button1_click(object sender, eventargs e)
  {

  system.drawing.printing.printdocument _document = new system.drawing.printing.printdocument();
  _document.printpage += new system.drawing.printing.printpageeventhandler(_document_printpage);
  _document.print();

  }
  void _document_printpage(object sender, system.drawing.printing.printpageeventargs e)
  {
  e.graphics.drawimage(image.fromfile(@"c:www.zzzyk.com1.png"), 0, 0);
  }

//图片打印方法二

private void printdocument1_printpage(object sender, system.drawing.printing.printpageeventargs e)
  {
  graphics g =e.creategraphics();  
  image image=(image)picturebox1.image;  
  g.drawimage(image,x,y, width,heigth);  
  g.dispose();  
  }
补充:asp.net教程,.Net开发
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,