Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to text warpping apply in Draw String??
Posted
Updated 14-Jan-13 22:04pm
v2

Hi Sruthi,

you just try

C#
PrintDocument p = new PrintDocument();
           p.PrintPage += delegate(object sender, PrintPageEventArgs e)
           {
               int i=0;
               foreach (string s in arr)
               {
                   i++;
                   e.Graphics.DrawString(s, new Font("Times New Roman", 12), new SolidBrush(Color.Black), new ReftangleF(0,0,p.Width,p.Height));
               }
           };
           try
           {
               p.Print();
           }
           catch (Exception ex)
           {
               throw new Exception("Exception Occured While Printing", ex);
           }
 
Share this answer
 
If you use
C#
Graphics.DrawString Method (String, Font, Brush, RectangleF, StringFormat)

and specify the rectangle,it will wrap inside the rectangle.

Check http://msdn.microsoft.com/en-us/library/21kdfbzs.aspx[^]
Hope that helps

Milind
 
Share this answer
 
Comments
sruthi sudan 15-Jan-13 4:39am    
hi thanks Milind_T for your reply..
but it will only print one page with specified width and height of that rectangle we specified..how can print whole string... my string is some what lengthy.. it can not hold only one page..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900