Cerebrus,
I am pleased to say that you are wrong (I don't mean that in a nasty way),
after hunting around furiously in the MSDN documentation I found the
answer!! Hurrah. The routine I currently use to output the text actually
does it, I just hadn't looked at the overloaded versions of the drawstring
method.
The code that does the magic is:
Dim rect As System.Drawing.RectangleF
Dim str as String
Str = sp.TaskMMDetails 'A piece of text from a class with lots of text
in it with breaks etc.
rect.X = LM + 100 'LM is a var holding my left margin so my
rectangle
rect.Y = y + (n * 100) 'y is a var tracking where I am down the
document incremented by lineheight
rect.Width = LM + 650 'width of my reports rectangle
rect.Height = 100 'Height of my reports rectangle
'Then write it out
e.Graphics.DrawString(Str, fb, Brushes.Black, rect)
The text is output to the report and is wrapped within the rectangle
specified by rect, it works brilliantly.
Additionally there is an additional parameter which deals with string
fromatting which I haven't unravelled yet that allows you to do stuff like
centre align right align etc also there are switches that allow you to
determine whether you want the text that would be cut off by the bottom of
the rectangle to appear or not and also whether it would insrt an elipsis at
the botytom right corner of the rectangle followed by the last word in the
text.
BRILLIANT! Cheers MS it was right under my nose all the time. Teach me to
explore all the overloaded versions.
For anyone interested the article that led me to this on MSDN is as follows:
http://msdn.microsoft.com/library/de...ntwinforms.asp
Thanks to Cor for putting me in the MSDN library which prompted me to look a
bit harder and find the answer there.
Thanks to Cerberus for responding, I was getting a bit despondent as a
couple of my questions here earlier seemed to be sitting unanswered.
--
Siv
Martley, Near Worcester, United Kingdom.
"Cerebrus" <zo*****@sify.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
Hi Siv,
There must be a .NET framework function that can
process a piece of text and insert the relevant breaks that doesn't
split
words and constrains it within a given rectangle that you specify.
No, there is no such pre-built function in .NET. You're going have to
code for such a functionality.
This thread asks a question that, I believe, is related to what you
want to do. Check it out and see if it helps,
<http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/34ec19dee644b0db>
Regards,
Cerebrus.