trimmed string when not fitting in a bounding box

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

Hi,

StringFormat of CF does not support StringTrimming...

Does any one know a handy method so that if i give string width and bounding
box, it gives me a new string with trimming characters "..." or a method
something similar to this.

For example if "ABCDEFGHIJK" is to be painted and if it does not fit in the
bounding box while doing g.DrawString, i am looking for a method which
checks the widths and gives me the required 'trimmed' string which will fit
like "ABCD..." I think i read a method similar to this in the framework but
have forgotten where is it...

Awaiting response...
 
Hi,

StringFormat of CF does not support StringTrimming...

Does any one know a handy method so that if i give string width and bounding
box, it gives me a new string with trimming characters "..." or a method
something similar to this.

For example if "ABCDEFGHIJK" is to be painted and if it does not fit in the
bounding box while doing g.DrawString, i am looking for a method which
checks the widths and gives me the required 'trimmed' string which will fit
like "ABCD..." I think i read a method similar to this in the framework but
have forgotten where is it...

Awaiting response...

You have to write your own word wrapping algorithm, and then write
your own control! Seriously, I did it.
 
Although I haven't tried it, I believe you can also P/Invoke the ExtTextOut
API as this has support for clipping.

Peter

--
Peter Foot
Microsoft Device Application Development MVP
peterfoot.net | appamundi.com | inthehand.com
APPA Mundi Ltd - software solutions for a mobile world
In The Hand Ltd - .NET Components for Mobility
 
Thanks Matthew, Peter,

I tried by own custom logic... I am yet to use the API suggested by
Peter....

Will update ASAP...

Thanks...
 
Back
Top