Left-justify text using DrawString

R

RobinS

Is it possible to left-justify, center, or right-justify text on a panel
when drawing it using DrawString?

I looked at the StringAlignment class, but all it has is far, near, and
center.

Thanks,
Robin S.
 
N

Nik Coughlin

RobinS said:
Is it possible to left-justify, center, or right-justify text on a
panel when drawing it using DrawString?

I looked at the StringAlignment class, but all it has is far, near,
and center.

Thanks,
Robin S.

Justify means to space the text out so both margins are even, as in the
right hand image here:

http://www.vbcorner.net/images/projects/TextJustifyAPI.gif

If you mean left and right *align* the text, far and near are the equivilent
to left and right align. The reason for this is that not all languages read
left-to-right, so if you are using a language, like English, that reads left
to right, near means left and far means right. If you are using a language
that reads right to left, near means right and far means left.
 
R

RobinS

Nik Coughlin said:
Justify means to space the text out so both margins are even, as in the
right hand image here:

http://www.vbcorner.net/images/projects/TextJustifyAPI.gif

If you mean left and right *align* the text, far and near are the
equivilent to left and right align. The reason for this is that not all
languages read left-to-right, so if you are using a language, like
English, that reads left to right, near means left and far means right.
If you are using a language that reads right to left, near means right
and far means left.

Thanks, Nik, for explaining that. I stuck far and near in there and they
did exactly what I wanted. Duh. Since we will be internationalizing our
application, it's nice to know that will work in the future, too. :-D

Robin S.
 

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