gdi+ drawstring

  • Thread starter Thread starter jack
  • Start date Start date
J

jack

In using GDI+ drawstring, if the string to be drawn is in
rtf format, how do I make GDI+ to recognize the rtf
attributes.

In other words, how do I draw one string in GDI+ , within
which the font size , bold / underline attributes are
different.
 
The DrawStirng funcition can be used like this
e.DrawString(font,brush,x,y)
If you want to write diffrent font ,I can give you a
example .

e.DrawStirng("System",myBrushI,100,100)
e.DrawString("Times New Roman",myBrushII,200,200)
then you can see two diffrent font .
ps: myBrushI&myBrushII is the brush varible you can
identify in front to the codes.
 
To my knowledge, this isn't possible with a single method call. You could
work out a scheme where you combine drawstring calls and measurestring
measurecharacterranges to update the positionals, but this could be more
work than its worth depending on what your goal is.

You might want to try your question in
microsoft.public.dotnet.framework.drawing and see if someone has already
worked out an algorithm to this effect. Some excellent GDI+ gurus hang out
there.
 
jack said:
In using GDI+ drawstring, if the string to be drawn is in
rtf format, how do I make GDI+ to recognize the rtf
attributes.

In other words, how do I draw one string in GDI+ , within
which the font size , bold / underline attributes are
different.

(I think) GDI+ can not recognize the RTF string. Maybe somebody knows the
answer in the more appropriate group
microsoft.public.dotnet.framework.drawing.
 
* "jack said:
In using GDI+ drawstring, if the string to be drawn is in
rtf format, how do I make GDI+ to recognize the rtf
attributes.

In other words, how do I draw one string in GDI+ , within
which the font size , bold / underline attributes are
different.

That's not supported by GDI+ directly, you will have to change the font
style "by hand" every time it changes in the RTF code. Why don't use a
RichTextBox to display RTF formatted text?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
Back
Top