How to make label and linklabel controls to accept multilined text at design time?

  • Thread starter Thread starter M Shafaat
  • Start date Start date
M

M Shafaat

Hi!
How can I make label, linklabel . controls to accept multilined text at
design time and in the properties window of Visual Studio?


Regards
M Shafaat
 
M Shafaat said:
Hi!
How can I make label, linklabel . controls to accept multilined text at
design time and in the properties window of Visual Studio?


Regards
M Shafaat
Unless I am nuts, the size of the label
determines how much text you can get in.
 
Yes, but then it wraps the text showing it in several lines. But What I want
to do is inserting line breaks at the places I decide, not the control
decides.

Regards
M Shafaat
 
I don't know of a "built-in" way of doing this. However, it's not pretty,
but one way to do this is by manually adding a new line ("\n") to the
property value string through the code that is generated in the
InitializeComponent() method. Then you will "see" the new line within the
property value in the Properties window as a small black block. When you
want to insert a new line in text for another control, simply copy the small
black block and paste it in the appropriate location.
 
Thank you Tim, that seems to be a good way.
I tested it on a test control and then copied the result from the design
property window and pasted it into the Text property of another control and
it worked.

This way (by first using a test or temporary control) you don't need to
touch the code automatically generated for your non-test-control which is
not to be modified manually.

Regards
M Shafaat
 
Back
Top