PC Review


Reply
Thread Tools Rate Thread

Automatically Wrap Text in Label

 
 
Yaakov
Guest
Posts: n/a
 
      21st Nov 2006

I have the following scenario: I have a TableLayoutPanel in my form. In
one of the cells I want to place a Label control to display some text.
The label might have just a few words. It might have a paragraph. I
would like the label text to automatically wrap inside the cell in the
TableLayoutPanel. If the row in the TLP is not large enough, it should
automatically grow so that it can display all of the text.

1) I have tried setting Dock:Fill and AutoSize:False on the label. This
will cause the text in the label to wrap, but it will not grow past the
size of the cell in the TLP. If I set the row in the TLP to be
AutoSize, the whole row becomes hidden.

2) If I set it to Dock:Top, AutoSize:False, and set the TLP row to
AutoSize, this works, as long as the height of the Label is set to a
value sufficient enough to hold all of the text. But if the height is
not big enough, the text gets cut off.

In case 2 above, it seems like I am on the right track, and that it
would work if I had some way of dynamically making the Label taller
depending on whether it still needed to wrap the text.

Any suggestions for me on how I can accomplish this?

 
Reply With Quote
 
 
 
 
Bill Angus
Guest
Posts: n/a
 
      23rd Nov 2006
Label control is not designed for this. Better to use a textbox control which has a possibility of scrollbars and a few other bits of functionality that you will need.... The backcolor and forecolor of the textbox can be set to any color you like, and the text-box disabled parameter can be set to true if you want it to look like a label control and to be read-only. Just make sure to change the forecolor text for your text control when it is disabled to something that you like and is not grey

Bill Angus, MA
http://www.psychtest.com
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrap text in field label Barry A&P Microsoft Access Forms 1 11th Oct 2008 12:26 AM
How to make a GridView item label wrap on long text strings? Keithb Microsoft ASP .NET 1 3rd Nov 2006 03:10 AM
Axis label text wrap =?Utf-8?B?c2hhcm9ucDc0Nzc=?= Microsoft Excel Charting 1 2nd Oct 2006 04:11 AM
text wrap in a label chad Microsoft Dot NET Compact Framework 3 8th Mar 2006 07:12 PM
how do you wrap text in a label in access? =?Utf-8?B?YmFpbGRq?= Microsoft Access Reports 1 5th Nov 2004 09:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:33 PM.