TO: blue_gao(小高) :打印我建立了一个类,明天我会把那部分贴出来,如果你急的话,建议你看 ...\Microsoft Visual Studio .NET\FrameworkSDK\Samples\QuickStart\winforms\samples\printing\example5.我的类就是改编自这个类,只是加了处理图片的语句.想向其它要代码的人说sorry,因为我用的控件是公司买的,所以如果要用的话,就必须要安装NI公司的那些控件,所以大家大概不会看到程序执行后的效果,但是代码是完全可用的,为了弥补我的错误,我会在程序中写大量的注释.明天早上回公司我就发,再次抱歉.......
[email protected]
我想要哦,给我一份吧。
MyPrintDocument mydc=new MyPrintDocument(image);
if(pageset!=null)
mydc.DefaultPageSettings=pageset;
PrintDialog dlg=new PrintDialog();
dlg.Document=mydc;
DialogResult res=dlg.ShowDialog();
if(res==DialogResult.OK)
mydc.Print();打印预览:
PrepareImage();
MyPrintDocument mydc=new MyPrintDocument(image);
if(pageset!=null)
mydc.DefaultPageSettings=pageset;
PrintPreviewDialog dlg = new PrintPreviewDialog();
dlg.Document=mydc;
dlg.ShowDialog();定义的打印类: //可能有些代码多余
public class MyPrintDocument : System.Drawing.Printing.PrintDocument
{
private Image image;
private System.ComponentModel.Container components;
public MyPrintDocument(Image image)
{
this.image = image;
}
protected override void OnBeginPrint(PrintEventArgs ev)
{
base.OnBeginPrint(ev);
}
protected override void OnPrintPage(PrintPageEventArgs ev)
{
base.OnPrintPage(ev);
ev.Graphics.DrawImage(this.image,0,0);//,296,272);
}
}
thinking of you
[email protected]
[email protected]
感谢,感谢!!感谢!!!
但愿我要的不是太晚!:)
[email protected]
thanx
[email protected]
并且我有一个建议:如果你能够在以后的写代码的过程中加上错误处理的代码会更好的。
我的电子邮件:[email protected]
谢谢!
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
谢谢
[email protected]
[email protected]