Clickable label and word wrap - how?

  • Thread starter Thread starter Krzysztof Kazmierczak
  • Start date Start date
K

Krzysztof Kazmierczak

Hi All!

I've found a great sample of clickable label (on
opennetcf.org forum). I have a question: is there a
possibility to add a word wrap to that label as in
default label control? How i can do that?

Thank You very much for any information
Very kind regards
Krzysztof Kazmierczak
 
Yes u can,
Actually I've already used the word wraping technique in
one of my custom control. The Basic idea is as follows:

All u have to do is, to check the length of ur Text in
terms of width of label, if ur text doesn't gets into a
single line of ur label, then inscrease the height of the
label by the required number of lines. You have to
calculate the height of the label control before u perform
DrawRectangle() operation.
Generally a single line occupies 8 pixel of height. So to
get the height , multiply 8 with number of lines required
to fill the label.
Hope this soln works for u.
 
Hi!

Thanks for your help. Unfortunately, when i have text in
clickable label control which requires 2 lines and i set
height of the control to (for example) 400 pixels, i
still have text in 1 line. It doesn't wrap ;) I really
don't know why.

Kind regards!
Krzysztof Kazmierczak
 
Hi,

Does your text contain whitespace? The word wrapping with labels is rather
weak, as it seems to depend on the text containing whitespace for the
wrapping algorithm (labels are based on the native static control).
Textboxes are a bit smarter - as they will workwrap without whitespace...I
would substitute your label for a read-only (possibly disabled) multiline
textbox if this is a problem for you.

Hope this helps,
-Katie

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

***.Net Compact Framework Info***
Faq:
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.a
spx
QuickStarts: http://samples.gotdotnet.com/quickstart/CompactFramework/
Samples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/h
tml/CompactfxTechArt.asp

--------------------
| Content-Class: urn:content-classes:message
| From: "Krzysztof Kazmierczak" <info@no_spamsmartsolutions.pl>
| Sender: "Krzysztof Kazmierczak" <info@no_spamsmartsolutions.pl>
| References: <[email protected]>
<[email protected]>
| Subject: Clickable label and word wrap - how?
| Date: Mon, 22 Dec 2003 01:38:46 -0800
| Lines: 32
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| thread-index: AcPIb2WUXHYMVZERTZWihHPE6C0EJQ==
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:41517
| NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi!
|
| Thanks for your help. Unfortunately, when i have text in
| clickable label control which requires 2 lines and i set
| height of the control to (for example) 400 pixels, i
| still have text in 1 line. It doesn't wrap ;) I really
| don't know why.
|
| Kind regards!
| Krzysztof Kazmierczak
|
| >-----Original Message-----
| >Yes u can,
| >Actually I've already used the word wraping technique in
| >one of my custom control. The Basic idea is as follows:
| >
| >All u have to do is, to check the length of ur Text in
| >terms of width of label, if ur text doesn't gets into a
| >single line of ur label, then inscrease the height of
| the
| >label by the required number of lines. You have to
| >calculate the height of the label control before u
| perform
| >DrawRectangle() operation.
| >Generally a single line occupies 8 pixel of height. So
| to
| >get the height , multiply 8 with number of lines
| required
| >to fill the label.
| >Hope this soln works for u.
| >
|
|
 
Back
Top