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

Setting the width of a RadProgressBarElement

1 Answer 82 Views
ProgressBar
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 1
Allan asked on 19 Jan 2009, 09:37 AM
I have a problem setting the width of the RadProgressBarElement so it resizes automatically to the content.
When i change the text in the element I would like it to resize so the text fits inside it instead of it diaspearing out of therighthandside.
I have tried setting the autosize setting to any given variation, but with no result.

Any ideas?

Regards Allan

PS: The RadProgressBarElement is added to a RadStatusStrip.

1 Answer, 1 is accepted

Sort by
0
Accepted
Victor
Telerik team
answered on 20 Jan 2009, 07:28 AM
Hi Allan,

Thanks for writing.

I am afraid the width of the RadProgressBarElement cannot be set automatically however you can do the same easily using some code. The work-around is to measure the string you want to set and set the size of the RadProgressBarElement to the string width. Please see the code snippet below:

Graphics g = radStatusStrip1.CreateGraphics();  
int width = (int)g.MeasureString(radProgressBarElement1.Text, radProgressBarElement1.Font).Width + 10;  
radProgressBarElement1.Size = new Size(width, radProgressBarElement1.Size.Height); 

Please write back if you have other questions.

Kind regards,
Victor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ProgressBar
Asked by
Allan
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or