Label AutoSize not working

4 posts, 1 answers
  1. Ralph
    Ralph avatar
    13 posts
    Member since:
    Jan 2008

    Posted 13 Jan 2010 Link to this post


    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..."

    Are these bugs or am I missing something?

  2. Answer
    Peter avatar
    1148 posts

    Posted 15 Jan 2010 Link to this post

    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,
    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.
  3. DevCraft R3 2016 release webinar banner
  4. jfkrueger
    jfkrueger avatar
    269 posts
    Member since:
    Jul 2012

    Posted 30 Mar 2011 Link to this post

    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!
  5. Peter
    Peter avatar
    1148 posts

    Posted 04 Apr 2011 Link to this post

    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,

    the Telerik team


Back to Top