This is a migrated thread and some comments may be shown as answers.

RadLabel - Calculate Size

3 Answers 248 Views
Label
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 17 Jul 2013, 06:40 PM
I have a user control with a TableLayoutPanel that has two columns (and one row).  One column is autosize, the other is absolute.  There is a RadLabel in the cell in the autosize column.  I'm programmatically loading a number of these user controls onto a FlowLayoutPanel.  They resize their widths if the user resizes the form.

I'm loading the text on the RadLabel from the database.  I would like to make the label figure out its size (width = FlowLayoutPanel's column width, height = whatever it takes to contain the text).  Then fix the height of the FlowLayoutPanel and the user control to be able to contain that RadLabel.

I have been looking all over the forum but I haven't figured out the magic combination of properties and calculations to make this work.  Can it be done?

Thank you,
Gary

3 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 22 Jul 2013, 02:02 PM
Hi Gary,

Thank you for writing.

This is not supported out of the box because TableLayoutPanel has own custom logic to control the size of inner Microsoft controls and this logic is not compatible with our controls.
In order to achieve what you need, you may control the MaxSize of the RadLabel. You should do that when you add the controls, and later when the user resizes the form.
I have attached a sample project showing everything in action.

Hope that helps. Please do not hesitate to contact us, should you need further assistance.

Regards,
Paul
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Doug
Top achievements
Rank 1
answered on 22 Jul 2013, 05:29 PM
Thank you, Paul.

I had discovered the MaxSize property and I was experimenting with that.  I would not have guessed that I needed to work with RadLabel.LabelElement.MaxSize.

Now I have things working almost the way I want.  Since I'm still developing the UI and the design is still in progress, I'll return to the details that I still need to work out later.  But your example got me exactly what I need.
0
Paul
Telerik team
answered on 24 Jul 2013, 03:19 PM
Hello Gary,

Thank you for writing back.

I am glad I could help. If you run in difficulties during the development we will do our best to assist you.

Best of luck with your projects.

Regards,
Paul
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Label
Asked by
Doug
Top achievements
Rank 1
Answers by
Paul
Telerik team
Doug
Top achievements
Rank 1
Share this question
or