Re: DrawString - few font styls in the same row



Hi Gidi,

If you're using GDI or GDI+ to render text then there is no simple way,
AFAIK, but it can be done. I believe that you'll have to calculate the
position of each contiguous block of formatted text and render it, in-place.

The TextRenderer.DrawText (2.0 framework) and Graphics.DrawString methods
both accept Font parameters. You can specify any combination of FontStyle
flags when creating a Font (e.g., Bold, Italic, Strikeout, Underline).

A simpler approach to displaying formatted text is to use the RichTextBox
control with RTF or the WebBrowser control (2.0 framework) with HTML.

--
Dave Sexton

"Gidi" <shnapsi@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:E45BA926-0D91-421C-9209-FA26A5903793@xxxxxxxxxxxxxxxx
Hi,

Is it possible to draw string with few font styls, like in WORD (i.e. Bold
and Underline) at the same line, on the same text ?

and is it possible that part of the line will be bold and the other one
not ?

Thanks,
Gidi.


.



Relevant Pages

  • Re: DrawString unicode
    ... GDI+ doesn't use the uniscribe to render the unicode string. ... > Are you certain that the font you are using is a font that supports the ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: GDI+ renders some phrases without spaces
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... The font comes out ... >>> I would assume IE uses the same GDI calls to render the font, ...
    (microsoft.public.dotnet.framework.drawing)
  • Problem with font metrics (Win32/GDI/GDI+)
    ... I have a problem relating to the font "Tw Cen MT" and its display via GDI+ ... At font sizes less than 119 points the text is rendered significantly above ... I've tested my code with many other fonts and they all appear to render ...
    (comp.fonts)
  • Re: Font representation
    ... But a font became... ... bold or something. ... It has another parameters like spacing or char width. ... There's an idea that it's caused by differences of GDI and GDI+. ...
    (microsoft.public.dotnet.framework)
  • Re: GDI+ Performance Question
    ... what is this Canvas object that you are using for drawing? ... I've been reading alot about how GDI+ does not ... The rendering algorithm is pretty sound, it'll only render the parts of the score that need to be. ... For performance reasons, I'm drawing to a bitmap and during scrolling, I'm actually only rendering parts of the bitmap, in order to keep performance under control, but I don't like that approach. ...
    (microsoft.public.dotnet.framework.drawing)

Loading