ProgressBar na StatusBar

Awe Pessoal esse post é sobre delphi como colocar um ProgressBar em uma StatusBar

é muito simples porém requer alguma atenção para seus códigos certo

vamos a prática

1 -> coloque uma StatusBar no form e ajuste a propriedade do painel:

Style = psOwnerDraw

2 -> Coloque um ProgressBar no Form e ajuste a propriedade:

Visible = False

3 -> No evento OnDrawPanel da Status Bar digite o código abaixo:

begin
if panel.index = 0 then
begin
ProgressBar1.Width := Rect.Right – Rect.Left +1;
ProgressBar1.Height := Rect.Bottom – Rect.Top +1;
ProgressBar1.PaintTo(StatusBar.Canvas.Handle, Rect.Left, Rect.Top);
end;
end;

4 -> agora coloque um buttom na form e no evento onclick do mouse digite o código abaixo:
var I : integer;

begin
for I := ProgressBar1.Min to ProgressBar1.Max do
begin
ProgressBar1.Position := I;
StatusBar1.Repaint;
Sleep(50);
end;
Sleep(500);
ProgressBar1.Position := ProgressBar1.Min;
StatusBar1.Repaint;
end;

Pronto agora execute o programa e veja o resultado.

abaixo segue uma imagem de como ficou o exemplo que fiz.

Progressbar

6 thoughts to “ProgressBar na StatusBar”

  1. Thank you for the auspicious writeup. It in fact was a amusement account it.
    Look advanced to more added agreeable from you!
    However, how can we communicate?

  2. I was curious if you ever thought of changing the page layout of your website?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having one or two images.

    Maybe you could space it out better?

  3. Just wish to say your article is as amazing. The clearness in your put up is
    just nice and that i can suppose you’re knowledgeable in this subject.
    Well along with your permission allow me to grasp your feed to keep up to date with coming near near post.
    Thank you a million and please carry on the rewarding work.

  4. You can definitely see your skills in the work you write.
    The arena hopes for more passionate writers such as you who
    are not afraid to mention how they believe. At all times follow
    your heart.

Comentários fechados.