| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2352 人关注过本帖
标题:richTextBox控件打印小票
只看楼主 加入收藏
copy462829
Rank: 1
等 级:新手上路
帖 子:112
专家分:0
注 册:2007-1-31
收藏
 问题点数:0 回复次数:0 
richTextBox控件打印小票
private void MyPrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs ev)
        {
  float linesPerPage = 0 ;
  float yPosition = 0 ;
  int count = 0 ;
  float leftMargin = ev.MarginBounds.Left ;
  float topMargin = ev.MarginBounds.Top ;
  string line = null ;
  Font printFont = richTextBoxXs.Font;
  SolidBrush myBrush = new SolidBrush ( Color.Black ) ;
  //计算每一页打印多少行
  linesPerPage = ev.MarginBounds.Height / printFont.GetHeight ( ev.Graphics ) ;
  //重复使用StringReader对象 ,打印出richTextBox1中的所有内容
  while ( count < linesPerPage && ( ( line = myReader.ReadLine ( ) ) != null ) )
  {
  // 计算出要打印的下一行所基于页面的位置
  yPosition = topMargin + ( count * printFont.GetHeight ( ev.Graphics ) ) ;
  // 打印出richTextBox1中的下一行内容
  ev.Graphics.DrawString ( line , printFont , myBrush , leftMargin , yPosition , new StringFormat ( ) ) ;
  count++ ;
  }
  // 判断如果还要下一页,则继续打印 BBS.网管论坛
  if ( line != null )
  ev.HasMorePages = true ;
  else
  ev.HasMorePages = false ;
  myBrush.Dispose ( ) ;
  }

上面这段代码在我们自己的打印机(不是小票机,一般的打印机)上能正常打印小票, 可是在客户的小票机(小票机)上却不能打印小票?
请高手指点?????
搜索更多相关主题的帖子: 小票 richTextBox 控件 float 打印 
2008-05-06 12:40
快速回复:richTextBox控件打印小票
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011170 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved