Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
485
Howto: Right align auto-sized Label
posted

Hi,

on a UltraGridLayoutPanel I positioned a UltraLabel so that it is right-aligned (Anchor = Right, Fill = None). The Text of the label can vary so that the size of the label cannot be determined at design or creation time. This also works fine, but the label gets not properly realigned in the grid, it expands to the right and is drawn outside of the right grid border, so that parts of the label are not visible anymore.

 

Any ideas?

 

Regards,

Michael

Parents
No Data
Reply
  • 71886
    Suggested Answer
    Offline posted

    Hello mgroeger,

    I was able to reproduce your behavior and would suggest you use an approach like the following:

    ultraGridBagLayoutPanel1.SetPreferredSize(ultraLabel1, ultraLabel1.Size + new Size(10, 0));

    You would have to set this line of code after the action which changes your ultraLable width.

    With this approach your label will 'expand' to the right way.

    Please note, we are making efforts to ensure all posts are addressed by an Infragistics expert. We believe that the other community members could benefit from this thread as well.

    Please do not hesitate to contact us if you need any additional assistance.

Children
No Data