[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

DrawString / Ellipsis / word gaps problem

VisualHint

12/21/2004 3:02:00 PM

Hi,

another very strange behaviour with ellpisis and the DrawString method.
If I display the string "This is a string" with no ellipsis, there is a
certain gap between words. Let's say 6 pixels between "This" and "is".
If the bounding rectangle is smaller and ellipsis appear, the gap
between thoses 2 words becomes 5 pixels. If I make the rectangle even
smaller, the gap becomes 4 pixels.

It means that while the user is resizing the bounding rectangle, the
string is displayed like shaking because of this changing gap between
words.

Did I miss something ? Is it a normal new behaviour in the way GDI+
works, or does it have simply a bug ?

Thanks for your help

Herve

5 Answers

Richard L Rosenheim

12/30/2004 6:35:00 AM

0

Just a guess, but it sounds like the text is being displayed as left and
right justified.

Richard Rosenheim


"cae" <cadilhac@gmail.com> wrote in message
news:1103641335.553594.21870@c13g2000cwb.googlegroups.com...
> Hi,
>
> another very strange behaviour with ellpisis and the DrawString method.
> If I display the string "This is a string" with no ellipsis, there is a
> certain gap between words. Let's say 6 pixels between "This" and "is".
> If the bounding rectangle is smaller and ellipsis appear, the gap
> between thoses 2 words becomes 5 pixels. If I make the rectangle even
> smaller, the gap becomes 4 pixels.
>
> It means that while the user is resizing the bounding rectangle, the
> string is displayed like shaking because of this changing gap between
> words.
>
> Did I miss something ? Is it a normal new behaviour in the way GDI+
> works, or does it have simply a bug ?
>
> Thanks for your help
>
> Herve
>


VisualHint

12/30/2004 1:13:00 PM

0

hummm, no, here is the format used:

StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Near;
Visually, it is left justified.

Herve

VisualHint

12/30/2004 1:19:00 PM

0

I should add that this is this combination that doesn't work properly:

StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Near;
drawFormat.FormatFlags = StringFormatFlags.NoWrap;
drawFormat.LineAlignment = StringAlignment.Center;
drawFormat.Trimming = StringTrimming.EllipsisCharacter;

Near is needed for left justification
NoWrap is needed so that I don't see the words going on a second line
Center is needed for a vertical center effect
and I need ellipsis

Any idea ?

Herve

Richard L Rosenheim

12/30/2004 9:07:00 PM

0

I would try it without the "drawFormat.LineAlignment =
StringAlignment.Center;" and see if it makes a difference with your spacing
problem.

Richard Rosenheim


"cae" <cadilhac@gmail.com> wrote in message
news:1104412738.660270.68040@z14g2000cwz.googlegroups.com...
> I should add that this is this combination that doesn't work properly:
>
> StringFormat drawFormat = new StringFormat();
> drawFormat.Alignment = StringAlignment.Near;
> drawFormat.FormatFlags = StringFormatFlags.NoWrap;
> drawFormat.LineAlignment = StringAlignment.Center;
> drawFormat.Trimming = StringTrimming.EllipsisCharacter;
>
> Near is needed for left justification
> NoWrap is needed so that I don't see the words going on a second line
> Center is needed for a vertical center effect
> and I need ellipsis
>
> Any idea ?
>
> Herve
>


VisualHint

12/31/2004 1:36:00 AM

0

You can trust me, I tried a lot of combinations...
Unwrapped text + ellipsis seems to be the problem.
I think there is a bug in the way ellipsis are handled in this case. I
even saw the gaps between some letters change. Could someone from
Microsoft confirm or share thoughts ?

Herve