We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Flowlayout and autosizing labels

Thread ID:

Created:

Updated:

Platform:

Replies:

15835 Jun 28,2004 09:14 PM UTC Jun 29,2004 03:30 PM UTC WinForms 1
loading
Tags: Tools
Andy
Asked On June 28, 2004 09:14 PM UTC

Is there any way I can get a label (ie. text) to be fully justified as part of a flow layout. In other words I have a panel which has a paragraph of text above it contained in a form and I want that paragraph of text to change its height according to the width of the form. The flow layout would take care of moving the panel below the text. Is this possible? Its something you get for free in HTML and i was surprised to see that neither microsoft nor syncfusions label controls allow for multi-line. any ideas? thanks -andy

Administrator [Syncfusion]
Replied On June 29, 2004 03:30 PM UTC

Hi Andy Here is a sample that demonstrates what you are looking for. - You need to set the Minimumsize proprty for the Form. - For the FlowLayout component, you need to set the LayOutMode to be Vertical and you also need to provide LeftMargin and RightMargin:. - To autosize the label control when you increase/decrease the form width, you need to listen to the FlowLayout''s ProvideLayoutInformation event to set the PreferredSize for the Label control. You have to do this because the .NET label contrOl does not have a concept of PreferredSize. private void flowLayout1_ProvideLayoutInformation(object sender, Syncfusion.Windows.Forms.Tools.ProvideLayoutInformationEventArgs e) { if (e.Control == this.label1 && e.Requested == LayoutInformationType.PreferredSize) { Graphics g = this.CreateGraphics(); SizeF szPref = g.MeasureString(this.label1.Text, this.label1.Font, this.ClientRectangle.Width); e.Size = new Size(this.ClientRectangle.Width-20, (int)szPref.Height + 5); e.Handled = true; g.Dispose(); } } Regards Arun

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;