How to handle StringTrimming.EllipsisCharacter in Vista

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom P.

    How to handle StringTrimming.EllipsisCharacter in Vista

    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
    DrawListViewSub ItemEventArgs.B ounds to draw the string but all that
    happens is the string wraps to the next line.

    Any help would be great.

    Tom P.
  • Tom P.

    #2
    Re: How to handle StringTrimming. EllipsisCharact er in Vista

    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 = StringFormatFla gs.LineLimit |
    StringFormatFla gs.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.


    On Mar 16, 12:12 am, "Tom P." <padilla.he...@ gmail.comwrote:
    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
    DrawListViewSub ItemEventArgs.B ounds to draw the string but all that
    happens is the string wraps to the next line.
    >
    Any help would be great.
    >
    Tom P.

    Comment

    Working...