473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Label AutoSize property does not work properly

Hello:

I am trying to use Autosize=true on a long string and it
extends off of my form, rather than increasing the number
of lines of the Label as the documentation says it should
do.

Would anyone know what other property I need to set to get
this to work properly? I have looked through them all and
cant find any. PreferredHeight is read only.

thank you in advance.
Nov 22 '05 #1
2 6359
I have found when using labels with large amounts of text,
it's better to size it myself. If you size the control to
fit within an area that you're comfortable with, the
control behaves better with auto-size off. If you look at
the property description of AutoSize in the Property
sheet, it says "Enables automatic resizing based on font
size. Note that this is only valid for label controls
that don't wrap text.". I have no idea which label
controls do wrap text. The standard label provides no
capability for this. You could use a textbox control with
MultiLine = True and WordWrap set to true. That might
give you the desired effect. You could play with the
colors and lock it to make it appear to be a label. Just
a thought.
-----Original Message-----
Hello:

I am trying to use Autosize=true on a long string and it
extends off of my form, rather than increasing the number
of lines of the Label as the documentation says it should
do.

Would anyone know what other property I need to set to getthis to work properly? I have looked through them all andcant find any. PreferredHeight is read only.

thank you in advance.
.

Nov 22 '05 #2
I have found when using labels with large amounts of text,
it's better to size it myself. If you size the control to
fit within an area that you're comfortable with, the
control behaves better with auto-size off. If you look at
the property description of AutoSize in the Property
sheet, it says "Enables automatic resizing based on font
size. Note that this is only valid for label controls
that don't wrap text.". I have no idea which label
controls do wrap text. The standard label provides no
capability for this. You could use a textbox control with
MultiLine = True and WordWrap set to true. That might
give you the desired effect. You could play with the
colors and lock it to make it appear to be a label. Just
a thought.
-----Original Message-----
Hello:

I am trying to use Autosize=true on a long string and it
extends off of my form, rather than increasing the number
of lines of the Label as the documentation says it should
do.

Would anyone know what other property I need to set to getthis to work properly? I have looked through them all andcant find any. PreferredHeight is read only.

thank you in advance.
.

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Harvey | last post by:
Hello: I am trying to use Autosize=true on a long string and it extends off of my form, rather than increasing the number of lines of the Label as the documentation says it should do. Would...
2
by: David Sworder | last post by:
Hi, A Windows form that I'm developing will have two controls: Label1 and Label2. Both controls are of type Label (go figure). The text of Label1 will not be known until runtime and may change...
0
by: Adonai | last post by:
Hi, I'm having an issue with this code that I'm writing, I'm curious as to why the windows form label (lblTime) isn't getting updated with the new variable when I use the timer. I made a blank form...
1
by: Weber Samuel | last post by:
Hi NG i try to catch the Application.Idle Event: --> Application.Idle += new EventHandler(OnIdle); Here's my problem: If i put a Label on my Form and set the Property AutoSize = true then...
2
by: Oenone | last post by:
I'm trying to create a form similar to a VB messagebox but with custom content. One of the things I want to be able to do is display some text in a label at the top of the messagebox form and have...
8
by: Jordi Rico | last post by:
Hi, I've made the next inherited class in Visual Studio 2005: Public Class LabelEx Inherits System.Windows.Forms.Label Sub New() MyBase.New() Me.ForeColor = Color.Black Me.AutoSize = False...
1
by: Patrick Lioi | last post by:
Label label = new Label(); label.Width = 1; label.AutoSize = true; label.Text = "A long string, requiring a width larger than 1."; //At this point, Width is still 1. What am I missing? ...
2
by: cj | last post by:
As I begin to do more and more with programs built from scratch in 2005 instead of those converted from 2003, I'm finding differences that are confusing. Why can't I set the size of a label in...
1
by: Ryou kaihou | last post by:
As we known, in Visual Stdio 2003 or 2005, the property of Autosize of Label is set to True by defaut, how can I customize this and set property of Autosize to False? Any ideas? Thanks
11
by: Peter Larsen [] | last post by:
Hi, I have two questions related to the Label control. How do i prevent the label from expand the canvas into 2 lines (word wrap) ?? At the moment i set AutoSize to false (to prevent the word...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.