Windows Develop Bookmark and Share   
 index > Windows Forms Designer > 'System.Windows.Forms.Label' does not contain a definition for 'PreferredHeight'
 

'System.Windows.Forms.Label' does not contain a definition for 'PreferredHeight'

Hi All,

I have huge text to display on the label. But i have specified the hegiht to 200; so till this height i am able to see the text and rest is not visible. So there any way to resize the label automatically??

I have tried using "AutoSize = true" asual as "PreferredHeight" but i am getting "'System.Windows.Forms.Label' does not contain a definition for 'PreferredHeight'" please can you help me what i need to do to fix this issue.

Thanks & Regards,
Sharan
Sharanforum  Wednesday, May 06, 2009 5:01 PM
just setting the AutoSize will do the job

Label1.AutoSize = True


Thanks, A.m.a.L | [Remember to click "mark as answered" when you get a correct reply to your question]
A.m.a.L - aditi.com - Think Product  Wednesday, May 06, 2009 5:35 PM

Hi Sharanforum,

Base on my test, the label will extend its height high enough to show all content. I still cannot understand why it does not work on your computer. Can you think about do it with a readonly multiline textbox? It can have the same effect as label and you don't need to put it into a Panel.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, May 08, 2009 4:48 AM
just setting the AutoSize will do the job

Label1.AutoSize = True


Thanks, A.m.a.L | [Remember to click "mark as answered" when you get a correct reply to your question]
A.m.a.L - aditi.com - Think Product  Wednesday, May 06, 2009 5:35 PM
Hi Amal,

Thanks for the reply, Even i have used this option also still i am getting 'System.Windows.Forms.Label' does not contain a definition for 'AutoSize'"
Please can you tell if u have any other solution. as this is very urgent for me...

Thanks & Regards,
Sharan
Sharanforum  Thursday, May 07, 2009 4:32 PM
Can you please provide the details of your development environment.

.Net framework?
Visual studio?


Thanks,
A.m.a.L

[Remember to click "mark as answered" when you get a correct reply to your question]
A.m.a.L - aditi.com - Think Product  Thursday, May 07, 2009 4:46 PM
Hi Amal,

I am using the Visual Studio 2005 Professional Edition. Version 8.0.5.

Thanks for replying me..:)


Thanks & Regards,
Sharan
Sharanforum  Thursday, May 07, 2009 7:44 PM

Hi Sharanforum,

Do you mean the Label control doesn't extend to enough height to show the whole text? Did you set the MaximumSize.Height for your Label control? Please set it to 0 so the height is unlimited. It can be extend to fit the contain height.

If you have any question, please feel free to tell me.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, May 08, 2009 3:46 AM
HiKira Qian,

Thanks for the reply, I have huge text to be displayed on the screen, and text is crossing the border so i dont have definate height for the label. so i just wanted to set the dynamic hegiht by setting the AutoSize or preferreHeight. But these options are not working on my Visual studio environment. So please can you tell me the alternatieve way to fix this.

Thanks in Advance:)

Thanks & Regards,
Sharan
Sharanforum  Friday, May 08, 2009 4:11 AM

Hi Sharanforum,

How huge is it?

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, May 08, 2009 4:15 AM
HiKira Qian,

This is the help text for the Application (Description about the Application).

Here what i did is,

I have Panel and set the property Autoscroll=true and on top of the panel i have added label. So i want to increase the label height dynamically so that i can scroll all my text.

Thanks & Regards,
Sharan
Sharanforum  Friday, May 08, 2009 4:29 AM

Hi Sharanforum,

Base on my test, the label will extend its height high enough to show all content. I still cannot understand why it does not work on your computer. Can you think about do it with a readonly multiline textbox? It can have the same effect as label and you don't need to put it into a Panel.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, May 08, 2009 4:48 AM

You can use google to search for other answers

Custom Search

More Threads

• Design controls at run-time without DesignSurface?
• How to make property visible in Visual studio designer?
• Glyph and Adorner Assistance
• Designer changes DataGridView styles
• Why is VS 2003 Designer Mode so slow in loading some forms?
• windows controls limit on a form??
• C# Listbox control from other forms
• Property value is not valid - Ambiguous match found
• Need Image Control With SubImages
• How do I create fun-style windows