DrawString - ellipsis support ?

  • Thread starter Thread starter robf
  • Start date Start date
R

robf

Hi,

Does anyone know how to achieve the same behavior full .NET allows with
DrawString / StringTrimming and have the system truncate long strings
with a trailing ellipsis (...) ? I am implementing my own painting in
a list, and want this behavior for strings longer than the display will
allow for...

This functionality seems to be missing from the .NET Compact Framework.
Ideas?

Thanks,

Rob
 
Do it yourself. Check if the string is too wide to fit. If so, pick a
character or two to remove and replace with the elipsis character. Narrow
enough now? If so, done. If not, repeat.

Paul T.
 
The solution is to pass it a StringFormat object whose Trimming property is set to one of the following:

StringTrimming.EllipsisCharacter
StringTrimming.EllipsisWord
StringTrimming.EllipsisPath

The first one cuts the string at the last possible character, the second cuts it off at the last possible word and the last one shows the ellipsis in the center of the string so that you can always see the begginning and end, usually used for long file paths.
 
Back
Top