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

progressbar position inside statusstrip

4 Answers 423 Views
StatusStrip
This is a migrated thread and some comments may be shown as answers.
Carlitos
Top achievements
Rank 1
Carlitos asked on 23 Aug 2016, 02:08 PM

Hi, 

Is it possible to place the progressbar inside the statusstrip to the right hand side? Seems all the controls at the bottom are placed from left to right. But I would like to have some on the right, and some on the left. 

Thanks, 

 

Carlitos

4 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 24 Aug 2016, 07:59 AM
Hello Carlitos,

Thank you for writing.

This can be achieved by dynamically setting the Margin of the progress bar when the form is resized. For example:
private void RadForm1_SizeChanged(object sender, EventArgs e)
{
    int totalWidth = radStatusStrip1.Width;
 
    int elementsWidth = 0;
    foreach (RadItem item in radStatusStrip1.Items)
    {
        elementsWidth += item.Size.Width;
    }
    int emptySpace = totalWidth - elementsWidth;
 
    if (emptySpace > 0)
    {
        radStatusStrip1.Items[radStatusStrip1.Items.Count - 1].Margin = new System.Windows.Forms.Padding(emptySpace-25, 0, 0, 0);// 25 pixels for the size grip
    }
 
}

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Dimitar
Telerik team
answered on 24 Aug 2016, 08:15 AM
Hello Carlitos,

It appears that there is an easier way to achieve this. First, you need to add a label with no text before the progress bar. Then you should set the Spring property of the label to true. I have attached an image that shows this approach. 

I hope this will be useful. 

Regards,
Dimitar
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Carlitos
Top achievements
Rank 1
answered on 24 Aug 2016, 01:07 PM

Thanks Dimitar for both methods. Your second solution think works the easiest. I found another solution similar to your first one. 

It was this: 

        private void RadFormMainSystem_SizeChanged(object sender, EventArgs e)
        {
            var newProgressBarSize = new Size(0, 18);

            var newWidth = radStatusStripSystem.Width - 600;

            newProgressBarSize.Width = newWidth >= 250 ? newWidth : 250;

            radReportProgressBar.Size = newProgressBarSize;
        }

But I will stick with your second solution (as there is no coding to maintain). 

Thanks!

 

Carlitos

0
Dimitar
Telerik team
answered on 25 Aug 2016, 07:36 AM
Hello Carlitos,

I am glad I could be of help. Let us know if you have any other questions.

Regards,
Dimitar
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
StatusStrip
Asked by
Carlitos
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Carlitos
Top achievements
Rank 1
Share this question
or