RaynorPao
版主
![](./myimg/board/mystar.gif) ![](./myimg/board/mystar.gif) ![](./myimg/board/mystar.gif) ![](./myimg/board/mystar.gif) ![](./myimg/board/mystar.gif)
![](http://delphi.ktop.com.tw/download.php?download=upload/48c9d66ac5033_KTOP-%E5%8C%85%E5%AD%90%28%E7%9C%BC%E9%8F%A1%29-Q-100x100.jpg) 發表:139 回覆:3622 積分:7025 註冊:2002-08-12
發送簡訊給我
|
引言:
比如資料庫有一百筆資料要處理...
我希望能夠在statusbar上顯示目前的處理進度...
就是像安裝軟體從0%.....100%這樣,請問大概要如何寫...
milkbear 你好:
可以使用 Samples 之下的 CGauge 元件,範例程式碼如下
< class="code">
// Unit1.h
class TForm1 : public TForm
{
__published: // IDE-managed Components
// ............................
private: // User declarations
TCGauge *cgg;
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
// Unit1.cpp
void __fastcall TForm1::Button1Click(TObject *Sender)
{
cgg->Progress=0;
for(int i=0; i<1000; i )
{
if(cgg->Progress<(i 1)*100/1000)
{
cgg->Progress=(i 1)*100/1000;
Sleep(1);
Application->ProcessMessages();
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
cgg=new TCGauge(StatusBar1);
cgg->Parent=StatusBar1;
cgg->Left=2;
cgg->Top=2;
cgg->Height=StatusBar1->Height-4;
cgg->Width=StatusBar1->Panels->Items[0]->Width-4;
cgg->ForeColor=clBlue;
cgg->BackColor=clBtnFace;
cgg->MinValue=0;
cgg->MaxValue=100;
cgg->Progress=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete cgg;
}
-- Enjoy Researching & Developing -- 發表人 - RaynorPao 於 2003/03/14 09:10:09
------ -- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
|