收藏Code: Printing a DataGrid (Visual C#)
2024-07-21 02:19:07
供稿:网友
code: printing a datagrid (visual c#)
this example demonstrates printing a datagrid control.
example
private void printgrid_click(system.object sender, system.eventargs e)
printdocument1.print();
private void printdocument1_printpage(system.object sender, system.drawing.printing.printpageeventargs e)
painteventargs mypaintargs = new painteventargs(e.graphics, new rectangle(new point(0, 0), this.size));
this.invokepaint(datagrid1, mypaintargs);
compiling the code
this example requires:
a button control named printgrid with a click event handler.
a datagrid control named datagrid1.
a printdocument component named printdocument1 with a printpage event handler.
the example code replaces the existing event handlers.
robust programming
the following conditions may cause an exception:
you do not have permission to access the printer.
there is no printer installed.
security
in order to run this example, you must have permission to access the printer.
from:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cscon/html/vclrfcodeprintingdatagridvisualc.asp
作者blog:http://blog.csdn.net/ncowboy/
相关文章
what's new in the .net framework 2.0 beta
visual web developer 2005 express edition beta 1 manual setup instructions
implementing reverse proxy in squid
更改squid的错误信息语言种类
.net里的哈希表和串行化