欢迎来到天天文库
浏览记录
ID:14271135
大小:41.00 KB
页数:11页
时间:2018-07-27
《能运行的c#打印功能》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、能运行的C#打印功能usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Drawing.Printing;namespacewfa//感谢百度知道798766,听来容易,用来简单//感谢网上的“春哥也编程”,原理明
2、确,代码详尽{publicpartialclassMDIParent1:Form{privateintchildFormNumber=0;publicMDIParent1(){InitializeComponent();}//PrintDocumentprintDocument;//privatevoidInitializeComponent()//{//构造公用类名//printDocument=newPrintDocument();//printDocument.PrintPage+=newPrintPageEv
3、entHandler(this.printDocument_PrintPage);//利于传递参数//}privatevoidShowNewForm(objectsender,EventArgse){FormchildForm=newForm();childForm.MdiParent=this;childForm.Text="窗口"+childFormNumber++;childForm.Show();}privatevoidOpenFile(objectsender,EventArgse){OpenFileDia
4、logopenFileDialog=newOpenFileDialog();openFileDialog.InitialDirectory=Environment.GetFolderPath(Environment.SpecialFolder.Personal);openFileDialog.Filter="文本文件(*.txt)
5、*.txt
6、所有文件(*.*)
7、*.*";if(openFileDialog.ShowDialog(this)==DialogResult.OK){stringFileName=openF
8、ileDialog.FileName;}}privatevoidSaveAsToolStripMenuItem_Click(objectsender,EventArgse){SaveFileDialogsaveFileDialog=newSaveFileDialog();saveFileDialog.InitialDirectory=Environment.GetFolderPath(Environment.SpecialFolder.Personal);saveFileDialog.Filter="文本文件(*.t
9、xt)
10、*.txt
11、所有文件(*.*)
12、*.*";if(saveFileDialog.ShowDialog(this)==DialogResult.OK){stringFileName=saveFileDialog.FileName;}}privatevoidExitToolsStripMenuItem_Click(objectsender,EventArgse){this.Close();}privatevoidCutToolStripMenuItem_Click(objectsender,EventArgse){
13、}privatevoidCopyToolStripMenuItem_Click(objectsender,EventArgse){}privatevoidPasteToolStripMenuItem_Click(objectsender,EventArgse){}privatevoidToolBarToolStripMenuItem_Click(objectsender,EventArgse){toolStrip.Visible=toolBarToolStripMenuItem.Checked;}privatevoi
14、dStatusBarToolStripMenuItem_Click(objectsender,EventArgse){statusStrip.Visible=statusBarToolStripMenuItem.Checked;}privatevoidCascadeToolStripMenuItem_Click(objectsender,Eve
此文档下载收益归作者所有