progressbar position inside statusstrip

5 posts, 0 answers
  1. Carlitos
    Carlitos avatar
    18 posts
    Member since:
    Nov 2015

    Posted 23 Aug Link to this post

    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

  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 24 Aug Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 24 Aug Link to this post

    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.
  5. Carlitos
    Carlitos avatar
    18 posts
    Member since:
    Nov 2015

    Posted 24 Aug Link to this post

    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

  6. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 25 Aug Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready