Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Autosize tab control after localization

Autosize tab control after localization

New Discussion
Valentina Cereseto
Valentina Cereseto asked on May 16, 2016 6:13 PM

Hi everybody,

I am building a Winform application with 16.1 using a UltraTabControl with LeftTop TabOrientation

The content (text) of my controls will change at runtime according to selected Culture.

What I would like to achieve, is a complete auto-sizing of controls, in order to fit inner content.

I almost made it. Everything is resizing (tableLayout panels, labels, text boxes, etc). Still one thing is missing: tabPage.

If I change Tab Header text, the header will resize properly, but the content of the tabpage doesn’t.

Is there a way to force the tabpage itself to resize?

You can notice from the attached picture that the tab header resizes, while the tab page does not. More specifically, the content of the tab page  resizes (label text, etc., according to Anchor property) but some controls overlap form border and are hence truncated, since the tab page itself does not resize.

Everything is set with AutoSize=True in my application, except the UltraTabControl itself, which does not provide such parameter. Can you suggest me a workaround to have the tabpage resizing according to inner controls?

I hope I made me understood

Thanks in advance

Valentina

Sign In to post a reply

Replies

  • 0
    Sahaja Kokkalagadda
    Sahaja Kokkalagadda answered on May 6, 2016 8:26 PM

    Hi Valentina,

    Looking at the screen shot, it looks like the contents of tab page are resizing. The Tab header text length changes when you switch between languages and the contents of the tab page are moved to accommodate that change. So anchoring the control that’s shown as a grey box on your tab page to Left and Right will resolve this issue.

    Please try this and let me know if you need any further assistance.

    Sincerely,
    Sahaja Kokkalagadda
    Associate Software Developer, Windows Forms

    • 0
      Valentina Cereseto
      Valentina Cereseto answered on May 9, 2016 7:13 PM

      Hi Sahaja,

      actually it is not working good. Yes, as I stated too, the Tab Header resizes, according to tab header text length. Unfortunately, the form iteself maintains same size. Contents are moved according to their anchor properties, but.. my grey box is actually a panel containing labels and textboxes. If tab header text length is very long, this panel is literally cut, a portion of it goes out of visibility.

      If text in Tab header gets wider, I see that UltraTabControl.TabPageSize gets smaller and smaller. I would like it to be adaptive!

      Is there a way to force the tab page size..to be the right size to accommodate all its content, instead to be (Form.size – TabHeader. NEW size)?

      Thanks a lot

      valentina

      • 0
        Mike Saltzman
        Mike Saltzman answered on May 9, 2016 7:31 PM

        Hi Valentina,

        I'm not sure I follow what you mean. If you make the tab headers bigger, the tab page has to get smaller. The alternative would be to make the entire Tab control larger, which means it would be clipped by the form. So then that means the solution would be for you to make the Form bigger – which is not something the tab control has any control over.

        So I'm not understanding what you want here.

      • 0
        Valentina Cereseto
        Valentina Cereseto answered on May 10, 2016 3:00 AM

        Hi Mike,

        thanks for your feedback.

        Yes you are right. I didn't make my issue clear. What I was thinking about is.. why the UltraTabControl does not provide AutoSize property?

        With every control. if the space needed is bigger than control size, everything would grow accordingly. Here, it is not possible.

        How could I achieve this, as you suggested, make the tab control larger?

        Thanks again

        Valentina

      • 0
        Mike Saltzman
        Mike Saltzman answered on May 10, 2016 2:33 PM

        Hi Valentina,

        AutoSize is typically used for simple controls. It's pretty easy to calculate the ideal size of a TextBox or a label. But for something like the tab control, this would be extremely difficult, if not impossible. The tab control would have to account for every tab and every control that would be withing that tab when the tab was selected, so this kind of calculation would require the control to select each tab one at a time and calculate the size of each tab client area. So that would be inefficient, not to mention confusing for programmers using the control because the Selected Tab would be changing constantly. 

        The ClientArea of the TabPage is a derived Panel control, I think. So it might be possible for you to call GetPreferredSize on the client area for each selected tab, if you wanted to try to do this calculation yourself. But it's probably not worth it.

      • 0
        Valentina Cereseto
        Valentina Cereseto answered on May 10, 2016 7:36 PM

        Hi Mike, 

        thanks for your explanation.

        Yes, this could be a difficult task.

        Since I am in the middle of a new UI layout of legacy application and we want to apply localization everywhere, an adaptive layout is kind of a requisite. Apart from UltraTabControl, are there other Infragistics "Container" controls that do not support auto sizing features? So far, I only got stuck with UltraTabControl and OptionSet. I need as much flexibility I can get

        Thanks a lot again

        Valentina

      • 0
        Mike Saltzman
        Mike Saltzman answered on May 11, 2016 2:47 PM

        Hi Valentina,

        Just to be clear, by "AutoSize" we are talking about the ability of a control to size itself to it's contents. Most of the editor controls have this. So that includes UltraTextEditor, UltraCheckedEditor, etc. Also UltraButton and UltraLabel have this.

        Most of the bigger, more complex controls like UltraTree or UltraGrid do not. I think this is pretty consistent with the inbox controls, as well. It makes sense to size a TextBox or Label to it's contents. But it doesn't make a lot of sense to size a grid or tree to their contents – since these controls have scrollbars and it's entirely expected that the contents will almost never fit inside the control.

      • 0
        Valentina Cereseto
        Valentina Cereseto answered on May 16, 2016 6:13 PM

        Thanks a lot Mike. Your reply clarified me a lot!

        Bye

        Valentina

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Valentina Cereseto
Favorites
0
Replies
8
Created On
May 16, 2016
Last Post
10 years, 4 months ago

Suggested Discussions

Created by

Created on

May 16, 2016 6:13 PM

Last activity on

Feb 23, 2026 10:31 AM