Fix Progessbar in status bar

  • Thread starter Thread starter alex
  • Start date Start date
A

alex

Hi,
is there a way to fix the position of the progressbar in the status bar.
when I resize the window, the progressbar stays at the initial location.

Thanks
Alex
 
Hello,

alex said:
thanks, looked it up but is it a VB.Net example ?

It can be translated to VB.NET and should give you an idea on how to cope
with the problem. If you have problems translating it, please feel free to
post your questions here.

Regards,
Herfried K. Wagner
 
Hi,
is there a way to fix the position of the progressbar in the status bar.
when I resize the window, the progressbar stays at the initial location.

Thanks
Alex

When you add the progress bar to the status bar, make sure you set the
progress bar's parent to be the status bar.
 
alex said:
How do I do that? Can that be done through the designer in the property
menu?

You'll have to do it in code:

ProgressBar1.Parent = StatusBar1

Once you do that, then the coordinates for sizing and placing the progress
bar will be relative to the status rather than the form. For example, if
you set the location of the ProgressBar to 10,10, then it will be 10 pixels
over and 10 pixels down from the top left of the status bar.

Chris
 
Thanks, part of it works now but...

I use
Me.progBar.Parent = stBar
Me.progBar.Location = New System.Drawing.Point(Me.stBar.Left +185,5)

This does the job and fixes the progress bar in the statusbar.
However, when I resize the window I would expect that the 185,5 is
constant from the top left of the stBar. But... onl the 5 from top is
fixed, the progress bar floats somewhere inside the status bar.

Any Idea why this could be.
 
Me.progBar.Parent = stBar
Me.progBar.Location = New System.Drawing.Point(Me.stBar.Left +185,5)

However, when I resize the window I would expect that the 185,5 is
constant from the top left of the stBar. But... onl the 5 from top is


I presume that you want the progress bar to always be 185 pixels from the
left of the status bar? Since the progress bar's coordinates are always
relative to the parent (status bar), there's no need to add 185 to the
Statusbar's left position, just use 185:

Me.progBar.Location = New System.Drawing.Point(185,5)

This line will place the progress bar 185 pixels over and 5 pixels down
from the top left of the status bar.

Chris
 
Back
Top