Text Clipping and TextMetric

P

Patrick Long

I want to call DrawString on some text and when I am goign to run over the
edge i want to truncate the text with elipsis ("...") The full .NET
Framework allows the stringformat argument to be passed to DrawString but
the CF does not.

I was looking at maybe P/Invoking GetTextExtent and TextMetrics to gte the
number od charcaters i need to chop out of my string and doing it myself.

Any ideas?

TIA

Pat Long
 
S

Serg Kuryata [MS]

You can use Graphics.MeasureString() to get string's width and calculate
how many characters needs to be truncated.

Best regards,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Patrick Long" <patrick.long@nospamplease_btinternet.com>
| Subject: Text Clipping and TextMetric
| Date: Mon, 20 Oct 2003 23:40:43 +0100
| Lines: 21
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: host81-128-103-15.in-addr.btopenworld.com 81.128.103.15
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:36394
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| I want to call DrawString on some text and when I am goign to run over the
| edge i want to truncate the text with elipsis ("...") The full .NET
| Framework allows the stringformat argument to be passed to DrawString but
| the CF does not.
|
| I was looking at maybe P/Invoking GetTextExtent and TextMetrics to gte the
| number od charcaters i need to chop out of my string and doing it myself.
|
| Any ideas?
|
| TIA
|
| Pat Long
|
|
| ---
| Outgoing mail is certified Virus Free.
| Checked by AVG anti-virus system (http://www.grisoft.com).
| Version: 6.0.525 / Virus Database: 322 - Release Date: 09/10/2003
|
|
|
 

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