Click here to Skip to main content
15,887,430 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
How can I resize ToolStripProgressBar within a StatusStrip to use the available width when the StatusStrip width changes?
There are two other items which are fixed size.
Posted
Updated 16-Jul-19 2:05am

Unfortunately ToolStripProgressBar doesn't support the Spring property, so you have to do it manually:
Handle the StatusStrip.Resize event, and modify the Progress bar.Width property.
toolStripProgressBar1.Width = statusDisplay.Width - 200;

Don't forget to set the ProgressBar.AutoSize property to False or changes will be ignored every time you make them.
 
Share this answer
 
Comments
[no name] 24-Jul-10 9:02am    
Reason for my vote of 5
Solved!
Member 13233037 6-Oct-21 2:30am    
The StatusStrip resize event never fires for me - perhaps it only works on manual changes
Another simple option is to place a normal progress bar on top of the tool strip area you want the progress and set the Anchor properties to bottom, left, right. Much easier solution than handling resize events.
 
Share this answer
 
Ah, the ToolStripProgressBard doesn't support a Resize event, I'll just put a text box for status and then a progress bar next to it and use the resize event on that as you say.
Thanks! :thumbsup:
 
Share this answer
 
Comments
OriginalGriff 24-Jul-10 9:11am    
The ToolStripProgressBar doesn't support a Resize event - but you wouldn't want that anyway, since you are trying to cause it to throw one! I meant the StatusStrip.Resize event - sorry, I should have been clearer.
Toli Cuturicu 25-Jul-10 9:08am    
Reason for my vote of 1
fake answer
Christian Graus 27-Aug-10 18:17pm    
You're supposed to push 'comment' to comment on replies.
private void statusStrip1_Resize(object sender, EventArgs e)
{
   toolStripProgressBar1.Size = new System.Drawing.Size(statusStrip1.Width - 20, 16); 
}
 
Share this answer
 
Comments
CHill60 31-Mar-17 6:47am    
Question was asked, answered and solution accepted nearly 7 years ago. You've added nothing new to the thread

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900