VS2005: Progress Bar in Status Bar

J

joey.powell

I am trying to use a progress bar inside of my C#.net windows form
application. The status bar (naturally) only needs to be visible when
the app is running a job. However, if I set visible=false for it then
the panels to the right all shift to the left and take its place (until
I set visible=true). This is very ugly!

I need to be able to hide the progress bar, but maintain its footprint
within its status bar panel. I have tried things like setting
Spring=true and Spring=false, and I am even using absolute widths for
all of the panels. There is no "alignment" for each panel, relative to
the statusbar container. That would probably work, because then I could
set the rightmost text panel to align right. Anyways, I can't make it
work.

This should be a piece of cake, but as far as I can tell it cannot be
done. Does someone out there know how to make it work?

JP
 
M

Marius Groenendijk

Hi Joey,

Say you have progress bar with at least 2 panels
don't use AutoSize on the panels if you don't have to
AFAICS this works just fine

ProgressBar pbar = new ProgressBar();
pbar.Parent = statusBar1;
pbar.Size = new Size(statusBarPanel2.Width, statusBar1.Height);
pbar.Location = new Point(statusBarPanel1.Width, 0);
pbar.Value = 20;
pbar.Visible = true;
 
J

joey.powell

Just verified that AutoSize=false on the status bar and all panels
within. That doesn't fix it. Remember that this is VS2005, if that
makes a difference?

Any other ideas, guys?
 
L

Larry Lard

I am trying to use a progress bar inside of my C#.net windows form
application. The status bar (naturally) only needs to be visible when
the app is running a job. However, if I set visible=false for it then
the panels to the right all shift to the left and take its place (until
I set visible=true). This is very ugly!

I need to be able to hide the progress bar, but maintain its footprint
within its status bar panel. I have tried things like setting
Spring=true and Spring=false, and I am even using absolute widths for
all of the panels. There is no "alignment" for each panel, relative to
the statusbar container. That would probably work, because then I could
set the rightmost text panel to align right. Anyways, I can't make it
work.

This should be a piece of cake, but as far as I can tell it cannot be
done. Does someone out there know how to make it work?

Workaround: have a ToolStripStatusLabel, the same width as the
ToolStripProgressBar, adjacent to it. In your app, ensure that the
label's visibility is always NOT the progressbar's visibility.

Probably have to play around with the Size to get it to look exactly
the same size.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top