This is a migrated thread and some comments may be shown as answers.

Label AutoSize not working

3 Answers 1302 Views
Label
This is a migrated thread and some comments may be shown as answers.
Ralph
Top achievements
Rank 2
Ralph asked on 13 Jan 2010, 07:42 AM
Hi

I'm using version Q3 2009 SP1.

I have a RadLabel (with AutoSize = True) on a form I use to indicate loading status.  I constantly change the Text in the RadLabel during the loading phase.  The problem is that the size of the RadLabel does not change after I set the Text.

The workaround is that I have to do the following:

lblLoading.AutoSize = false
lblLoading.Text = _loadingText; 
lblLoading.AutoSize = true

Also I've noticed that it does not work out the correct size of the RadLabel if the form is not shown (even with the above workaround). 
So the following code snippet will not work, I need to move the setting of LoadingText to after the Show().

frmLoading loadingForm = new frmLoading(); 
loadingForm.LoadingText = "Validating License..."
 
loadingForm.Show(); 

Are these bugs or am I missing something?

Ralph

3 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 15 Jan 2010, 08:44 AM
Hello Ralph,

Thank you for reporting this issue. I managed to reproduce it and I logged it in our bug tracking system. It will be addressed in one of our upcoming releases.

As a workaround, please set the property LabelAutoSize to true in FormLoad method:

private void Form1_Load(object sender, EventArgs e)
{
         radLabel1.AutoSize = true;
}
 
private void timer1_Tick(object sender, EventArgs e)
{
         radLabel1.Text += "a";
}

If you have any other questions, please write back.

Best wishes,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
jfkrueger
Top achievements
Rank 1
answered on 30 Mar 2011, 06:26 PM
Just an FYI...

This is still an issue. Setting the AutoSize property in the form load even has the exact same effect as setting it declaratively...IE it does not work. It auto-sizes to whatever is in the label at the time of the form loading and if you update the text during execution the label does NOT autosize again, it stays the same size as when the form is loaded.

Ralph's workaround of setting autosize=false, changing the text, and then setting it back to true is the only way I could get it to work. This is using Q1 2011 controls.

Just letting you know, thanks!
0
Peter
Telerik team
answered on 04 Apr 2011, 03:51 PM
Hello jfkrueger,

Thank you for the feedback.

It seems that RadStatusStrip suppresses the RadLabelElement layout and RadLabel does not calculate the text size correctly. However, I am not able to reproduce the issue if I follow the workaround that I provided in my previous response. Maybe, I am missing something specific that you have in your case.

Therefore, I would kindly ask you to open a new support ticket and send me a sample project that demonstrates the issue. This will allow me to investigate the case further.

Best wishes,

Peter
the Telerik team

 

Tags
Label
Asked by
Ralph
Top achievements
Rank 2
Answers by
Peter
Telerik team
jfkrueger
Top achievements
Rank 1
Share this question
or