Anchor ToolStripProgressBar to right of StatusBar(StatusStrip)

I have a form with a statusbar that has 2 ToolStripStatusLabels followed by a ToolStripProgressBar. I want the progressbar to be always anchored to the right of the statusbar - so when the window is resized/maximized, it should automatically move/repaint.

I thought this would be as simple as setting the 1st (left aligned) ToolStripStatusLabel's Spring property to true, so when the form is resized/increased in size, and there is more space available, the 1st ToolStripStatusLabel would fill up that space and automatically push the ToolStripProgressBar to the Right.

But not only does that not do what I want - the 1st ToolStripStatusLabel actually covers up both the 2nd StatusLabel and the ProgressBar, basically occupying the whole statusbar. None of the ToolStrip controls have Anchor or even a MinSize.

SO how do I :

  1. Anchor the ToolStripProgressBar to right of StatusBar(StatusStrip)
  2. Mix some fixed size items (e.g the ToolStripStatusLabel2 and ToolStripProgressBar) with a variably sized ToolStripStatusLabel1 that grows when there is extra space?

Thanks in advance for your time and help !


13.10.2009 20:22:33

For all who may be interested.. Anchor property is available, although in Code only (not in designer) ...but in any case, it DOES NOT work.. I left a BUG in Connect and got the generic WillNotFix with the Message seeming to indicate they'll consider it only for a major revision.

For some reason the "Spring" property seems to be erratic.. In my ultra-simpistic examples it is working, but in some others where I do some custom painting (but in Child Forms in a MDIPArent, with the latter having ht eStatusBar) it is not. In those cases, there's still a simple workaround though - in the ReSize event of the MDIParent Form (that has the statusbar) change the size of the StatusLabel to make it bigger in the same proprtion as th width-change, so it pushes the ProgressBar to the right edge of the StatusBar

26.10.2009 20:31:06

There's a simple solution. Make one fake ToolStripStatusLabel, empty the .Text and set .Spring = true;

After that, add your ToolStripProgressBar. Make sure the order is label first, then progressbar.

17.03.2011 04:24:57

First change AutoSize to false

toolStripProgressBar.AutoSize = false;

Then subscribe statusStrip's size changed event

statusStrip1.SizeChanged += statusStrip1_SizeChanged;

Finally change the bar's width in the event handler

private void statusStrip1_SizeChanged(object sender, EventArgs e)
   toolStripProgressBar.Width = statusStrip1.Width - 95;
8.04.2013 08:09:00
  1. Set the StatusStrip, LayoutStyle property to HorizontalStackWithOverflow.
  2. Set the control Alignment to Right for the control you want to be to the right.
8.02.2019 17:24:47
This works, but the StatusStrip property is named "LayoutStyle," not "Layout."
oldvbguy 6.02.2019 23:16:42