Winforms formatting text issues

E

Ethan Strauss

Hi,
I have a Winforms app (in C#.Net 2.) which has to display some relatively
long lists of information. Right now, I am just putting on the info on a
multiline label, one item per line. I would like to be able to do things like
adjust line spacing, make certain items bold and so forth. Is there an easy
way to do that?
I know I can use a Rich Text Box and I am also thinking about making each
item it's own label and adjusting it location programatically, but before I
start on either of those, I want to know if I am missing something...

Thanks!
Ethan
 
A

Alberto Poblacion

Ethan Strauss said:
I have a Winforms app (in C#.Net 2.) which has to display some
relatively
long lists of information. Right now, I am just putting on the info on a
multiline label, one item per line. I would like to be able to do things
like
adjust line spacing, make certain items bold and so forth. Is there an
easy
way to do that?
I know I can use a Rich Text Box and I am also thinking about making
each
item it's own label and adjusting it location programatically, but before
I
start on either of those, I want to know if I am missing something...

There's another possibility that you may consider:
In the form's Paint event, grab the e.Graphics parameter, and then
execute a series of e.Graphics.Drawstring(...) calls to paint all the lines
that you need to display. This gives you complete control on the spacing and
formatting of your info, just by playing with the parameters of DrawString.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top