Skip to content

User Control AutoSize question #1199

Closed
Closed

Description

@itg-assistant

Matthew Ferry asked 2017-11-03 00:57:02 UTC

I have a user control, which has a label.

I want to put some multi line text in the label, and have the label and user control resize vertically.

AutoSize seems to only size the label horizontally, not vertically.

Any help for this?

Thanks,

Matthew

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-11-03 18:09:25 UTC

    The text in the label has CRLF?

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Matthew Ferry answered 2017-11-03 21:33:17 UTC

    The text in the label is created by the user in page of the app - using TinyEditor, so I imagine that would be "
    "  - label is set to allowhtml.

  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-11-04 23:34:47 UTC

    Try this:

    private void button1_Click(object sender, EventArgs e)
    {
    this.label1.Text = this.tinyEditor1.Text;

    Wisej.Base.TextUtils.MeasureTextAsync(this.label1.Text, true, this.label1.Font, (size) => {
    this.label1.Size = size;
    });
    }

    HTML text has to be measured on the client using Wisej.Base.TextUtils.MeasureTextAsync.

    If you the set containing Panel to AutoSize=true and fix the Minimum and Maximum Width it will grow vertically to fit the content. May have to change the AutoSizeMode to GrowAndShrink if you want the panel to shrink.

    There is also a bug with the regular AutoSize implementation of Label and Button not considering CRLF to grow vertically and not using the Min/Max constraints.

  4. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2017-11-05 12:59:16 UTC

    Bugs are logged as WJ-8566 and WJ-8567 and will be fixed in the next Wisej build. Regards, Frank

  5. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2017-11-16 00:48:10 UTC

    Hi Matthew,

    WJ-8566 and WJ-8567 are fixed in the latest Wisej release (1.4.50).

    Best regards
    Frank

  6. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Robert answered 2018-03-09 22:05:00 UTC

    I am noticing that the label's autosize is not really working.  At runtime, I am setting a new text (2 words) and it seems that it is not displaying the 2nd word, like the label borders are not wide enough when autosize = true.  Is this a bug that has already been fixed?

    Also, on the previous note about using MeasureTextAsync,  how do you write this example in VB.NET ?

    Thanks in advance

    Robert

  7. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2018-03-09 22:08:32 UTC

    Send a test case please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions