469,085 Members | 1,047 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,085 developers. It's quick & easy.

DrawString - few font styls in the same row

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.
Nov 28 '06 #1
1 1490
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" <sh*****@hotmail.com.dontspamwrote in message
news:E4**********************************@microsof t.com...
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.

Nov 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by David Lindgren | last post: by
reply views Thread by Marc Ouellette | last post: by
3 posts views Thread by =?Utf-8?B?SlIx?= | last post: by
2 posts views Thread by Tony Johansson | last post: by
9 posts views Thread by kynos | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.