PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
text wrap in a label
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
text wrap in a label
![]() |
text wrap in a label |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Does anyone know how to do a text wrap in a label or checkbox control,
in CF? If so what is the code? I have tried a few things like /r/n and System.Environment.NewLine but i'm having ZERO luck can you help!!!! Thanks! Chad |
|
|
|
#2 |
|
Guest
Posts: n/a
|
try \r\n
and set Multiline = true |
|
|
|
#3 |
|
Guest
Posts: n/a
|
I tried both in my CF project and neither worked, is there no way to do
this? |
|
|
|
#4 |
|
Guest
Posts: n/a
|
As far as I remember....if you increase the height of the label, i.e.
run it into multiple lines....the text should auto-wrap. Now, to find out exactly how many lines you want the label height to expand to.....you'll have to find out the length of the text in pixels....CF1.0 has no support but CF2.0 has a public method MeasureString(...) or something like that in the System.Drawing.Graphics class which you can use to get the string length in pixels. Divide this length by the wrap-length and you get the number of lines the text 'would' wrap into....so simply set the label's height to fit those many lines of text...voila! For CF1.0, I remember, we had to maintain a static list of each character with its pixel width...only to find out the length of an entire text in pixels!!! |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

