How to?

J

Jacek Jurkowski

ev.Graphics.DrawString(line, printFont, Brushes.Black,
leftMargin, yPos, format);

How to make drawned string to fit into a container
and brake into a new line content that doesnt fit?
 
P

Pavel Minaev

ev.Graphics.DrawString(line, printFont, Brushes.Black,
                   leftMargin, yPos, format);

How to make drawned string to fit into a container
and brake into a new line content that doesnt fit?

You should use Graphics.DrawString() overload that takes a RectangleF
rather than Point or a pair of ints - e.g. DrawString(Stirng, Font,
Brush, RectangleF). Then, the text will be wrapped to fit the
rectangle specified.
 
J

Jacek Jurkowski

Yes i Tried this but how to position string into Rectangle?

while(line != null)
{
ev.Graphics.DrawString(line, myFont,
Brushes.Black,(RectangleF)myRectangle)
}

but every line is written on the above so everythink is melt
at the left,top corner of the rectangle. How to increment the
position of the next line?



ev.Graphics.DrawString(line, printFont, Brushes.Black,
leftMargin, yPos, format);

How to make drawned string to fit into a container
and brake into a new line content that doesnt fit?

You should use Graphics.DrawString() overload that takes a RectangleF
rather than Point or a pair of ints - e.g. DrawString(Stirng, Font,
Brush, RectangleF). Then, the text will be wrapped to fit the
rectangle specified.
 
T

TAB

You have to concatenate all strings into one string, and then draw it.
Every time you draw a string it starts at upper left corner of the
rectangle.
Or else you have to measure string height and move the rectangle down for
each line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top