471,591 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,591 software developers and data experts.

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 1547
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 XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.