StreamReader streamToPrint = new StreamReader ("PrintMe.Txt");
try {
TextFilePrintDocument pd = new TextFilePrintDocument(streamToPrint); if (storedPageSettings != null) {
pd.DefaultPageSettings = storedPageSettings ;
} PrintPreviewDialog dlg = new PrintPreviewDialog() ;
dlg.Document = pd;
dlg.ShowDialog(); } finally {
streamToPrint.Close() ;
}//TextFilePrintDocument pd = new TextFilePrintDocument(streamToPrint);什么意思啊。怎么在调试的时候说没有TextFilePrintDocument
try {
TextFilePrintDocument pd = new TextFilePrintDocument(streamToPrint); if (storedPageSettings != null) {
pd.DefaultPageSettings = storedPageSettings ;
} PrintPreviewDialog dlg = new PrintPreviewDialog() ;
dlg.Document = pd;
dlg.ShowDialog(); } finally {
streamToPrint.Close() ;
}//TextFilePrintDocument pd = new TextFilePrintDocument(streamToPrint);什么意思啊。怎么在调试的时候说没有TextFilePrintDocument
解决方案 »
- socket网络编程如何应用于局域网?
- 用c#实现手机短信提醒功能(非短信猫)
- .net 机试题目证集
- 我...我...就是想知道...那个...
- c#中的委托什么时候用到?它与事件有什么关系?请各位大虾指点迷津啊
- 实现asp.net用户登录中的问题
- C#学习中,请各位高手指点!!!,答者有分
- socket 通 讯 的 时 候 绑 定 ip 地 址 的 时 候 出 错
- 请问一下用windows media sdk怎么能取出一个wma,或一个wmv中的所有脚本命令,和对应的时间(200分急用c#,vb.net都可)
- asp 页面强制刷新问题
- 对于把更新后的结果存储到数据库里很迷茫
- 内部编译器错误
private StreamReader streamToPrint = null ; public TextFilePrintDocument(StreamReader streamToPrint) : base () {
this.streamToPrint = streamToPrint ;
} //Override OnBeginPrint to set up the font we are going to use
protected override void OnBeginPrint(PrintEventArgs ev) {
base.OnBeginPrint(ev) ;
printFont = new Font("Arial", 10);
} //Override the OnPrintPage to provide the printing logic for the document
protected override void OnPrintPage(PrintPageEventArgs ev) { base.OnPrintPage(ev) ; float lpp = 0 ;
float yPos = 0 ;
int count = 0 ;
float leftMargin = ev.MarginBounds.Left;
float topMargin = ev.MarginBounds.Top;
String line=null; //Work out the number of lines per page
//Use the MarginBounds on the event to do this
lpp = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics) ; //Now iterate over the file printing out each line
//NOTE WELL: This assumes that a single line is not wider than the page width
//Check count first so that we don't read line that we won't print
while (count < lpp && ((line=streamToPrint.ReadLine()) != null)) {
yPos = topMargin + (count * printFont.GetHeight(ev.Graphics)); //Print Preview control will not work.
ev.Graphics.DrawString (line, printFont, Brushes.Black, leftMargin,
yPos, new StringFormat()); count++;
} //If we have more lines then print another page
if (line != null)
ev.HasMorePages = true ;
else
ev.HasMorePages = false ;
}}
http://community.csdn.net/Expert/topic/3278/3278050.xml?temp=.5012934下载
www.alinksoft.com打印对话框的文章
http://blog.csdn.net/error.aspx?aspxerrorpath=/flygoldfish/archive/2004/08/17/77208.aspx