How to handle StringTrimming.EllipsisCharacter in Vista

T

Tom P.

I am doing some special painting in a listview control. I have gotten
the drawing of the string to cut off and ellipse correctly in XP but
in Vista the cutoff and ellipse never happen. I know it's possible,
Windows File Manager does it - when a filename is too long it'll
ellipse the missing part. My control just wraps it to the next line. I
can't find a way to either set the height of the ListViewItem or get
the ellipse to happen correctly. What is going on? I use the
DrawListViewSubItemEventArgs.Bounds to draw the string but all that
happens is the string wraps to the next line.

Any help would be great.

Tom P.
 
T

Tom P.

Thanks for the help, but I found what I needed. Apparently, XP has a
default handling for FormatFlags but Vista does not, so they need to
be explicitly set like so:

sf.FormatFlags = StringFormatFlags.LineLimit |
StringFormatFlags.NoWrap;

This means only format as many lines as will fit in the rectangle, and
do not wordwrap (this forces the string out of the bounding rectangle
and thus causes an ellipsation).

Tom P.
 

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