如何在C#中打印冗长的字符串? [英] HOW CAN PRINT lengthy string IN C#?

查看:180
本文介绍了如何在C#中打印冗长的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如何使用C#打印冗长的字符串?



im使用

Hi all,
How i can print a lengthy string using C#?

im using

myReader = new StringReader(strText);
           PrintDocument p = new PrintDocument();
           p.PrintPage += delegate(object sender1, PrintPageEventArgs ev)
             {

                    ev.Graphics.DrawString(//parameters)
              };


           try
           {
               p.Print();
           }
           catch (Exception ex)
           {
               throw new Exception("Exception Occurred While Printing", ex);
           }





这里使用ev.Graphics.DrawString()方法,但是..

得到错误TextWrapping没有出现在这个..

这个问题我刚刚在Drawstring中添加了新的RectangleF()//这里像新的RectangleF(00,00,00,00)

> 00表示它仅用于演示目的。

在此RectangleF()实现之后它只打印一页并且它将获得包装输出但是它的打印只发生在一页



如果更清楚会告诉你细节。

谢谢

希望你的评论和回复..



here using ev.Graphics.DrawString() method but..
its getting error TextWrapping is not occuring to this..
for that issue i just added new RectangleF() inside Drawstring(//here like new RectangleF(00,00,00,00)
>00 means its only for demo purpose.
after this RectangleF()implementation its only print one page and it will get wrapped output but its printing occur only for one page

if more clear will tell you detail.
thanks
Hoping for your comment and reply..

推荐答案

顺便说一句,我刚刚回复了其中一个查询...



检查
打印时进行文字处理 [ ^ ]



你需要使用Graphics.DrawString方法(String,Font,Brush,RectangleF,StringFormat)



希望有帮助

Milind
Co-incidentally, I just replied to one of teh query just now...

Check
Textwrapping while printing[^]

You need to use Graphics.DrawString Method (String, Font, Brush, RectangleF, StringFormat)

Hope that helps
Milind


这篇关于如何在C#中打印冗长的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆