ProgreesBar no StatusBar
19/01/2010
0
Fala Galera, estou com uma duvida aqui e queria a ajuda de vcs.
Estou exportando dados do meu Grid para o Excel e nisso eu tenho um progressbar no statusbar com esse codigo.
No StatusBar no evento OnDrawPanel
if panel.index = 5 then begin
ProgressBar1.Width := Rect.Right - Rect.Left + 1 ;
ProgressBar1.Height := Rect.Bottom - Rect.Top + 1 ;
ProgressBar1.PaintTo(StatusBar1.Canvas.Handle, Rect.Left, Rect.Top); A Minha duvida é o seguinte quando eu termino a exportação o progrresBar não desaparece ele fica lá embaixo carregado eu já tentei de tudo mas não consegui fazer com que quando acaba a exportação ele fique visible = false. Aguem poderia me dar uma luz
ProgressBar1.Width := Rect.Right - Rect.Left + 1 ;
ProgressBar1.Height := Rect.Bottom - Rect.Top + 1 ;
ProgressBar1.PaintTo(StatusBar1.Canvas.Handle, Rect.Left, Rect.Top); A Minha duvida é o seguinte quando eu termino a exportação o progrresBar não desaparece ele fica lá embaixo carregado eu já tentei de tudo mas não consegui fazer com que quando acaba a exportação ele fique visible = false. Aguem poderia me dar uma luz
Clei Martins
Curtir tópico
+ 0
Responder
Posts
19/01/2010
Wilson Junior
Olha, não é das melhores opções, mas funciona. Foi o que consegui mais rapidamente, talvez se parar para pesquisar deve ter outra forma.
procedure StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
const Rect: TRect);
begin
if Panel.Index = 5 then
begin
if ProgressBar1.Visible then
begin
ProgressBar1.Width := Rect.Right - Rect.Left + 1 ;
ProgressBar1.Height := Rect.Bottom - Rect.Top + 1 ;
ProgressBar1.PaintTo( StatusBar1.Canvas.Handle, Rect.Left, Rect.Top );
end
else
begin
Panel.Style := psText;
Panel.Style := psOwnerDraw;
end
;
end
;
end;
Quando quiser mostrar ou não o ProgressBar1 deve ser chamdo o evento Refresh.
ProgressBar1.Visible := True; { ou False }
StatusBar1.Refresh;
Espero ter ajudado.
procedure StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
const Rect: TRect);
begin
if Panel.Index = 5 then
begin
if ProgressBar1.Visible then
begin
ProgressBar1.Width := Rect.Right - Rect.Left + 1 ;
ProgressBar1.Height := Rect.Bottom - Rect.Top + 1 ;
ProgressBar1.PaintTo( StatusBar1.Canvas.Handle, Rect.Left, Rect.Top );
end
else
begin
Panel.Style := psText;
Panel.Style := psOwnerDraw;
end
;
end
;
end;
Quando quiser mostrar ou não o ProgressBar1 deve ser chamdo o evento Refresh.
ProgressBar1.Visible := True; { ou False }
StatusBar1.Refresh;
Espero ter ajudado.
Responder
19/01/2010
Clei Martins
Valeu pela ajuda , mas quando eu coloco isso ao eu acessar meu form ele fica tipo que meio um for sem fim fica parecendo que está rofando alguma coisa e não aparece meu grid com minhas informações que quero exportar , acredito que ele deve estar processando algo , e quando eu tiro o codigo o sistema roda certinho, teria algo para fazer quanto a isso ?
Responder
Clique aqui para fazer login e interagir na Comunidade :)