//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Progress_F.h" #include "common.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" //--------------------------------------------------------------------------- #define IDS_ESTIMATEDTIME StringTable[0] #define IDS_ELAPSEDTIME StringTable[1] #define IDS_PROCESSTIME StringTable[2] //--------------------------------------------------------------------------- __fastcall TProgressForm::TProgressForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TProgressForm::FormCreate(TObject *Sender) { //====================================================== StringTable.Create(DirectoryBin, Language, "Progress"); SetSmallFont(Font); Caption = IDS_PROCESSTIME; Label1->Caption = IDS_ESTIMATEDTIME; Label5->Caption = IDS_ELAPSEDTIME; //====================================================== st = clock(); } //--------------------------------------------------------------------------- void __fastcall TProgressForm::SetRatio(double Value) { int t, h, m, s; lbRatio->Caption = Format("%d%%", OPENARRAY(TVarRec, ((int)(Value*100)))); ProgressBar1->Position = Value*100; // express percentage if(Value >0.0) { t = (clock() - st)/Value ; // Estimated Time if(t >= 360000) {h = t/360000; t -= h*360000;} else h = 0; if(t >= 6000) {m = t/6000; t -= m*6000;} else m = 0; s = t/100; lbest_time->Caption = Format("%2d : %2d : %2d", OPENARRAY(TVarRec, (h, m,s))); //the method how to output some varialbes in one Label t = clock() - st; //Elapsed Time if(t >= 360000) {h = t/360000; t -= h*360000;} else h = 0; if(t >= 6000) {m = t/6000; t -= m*6000;} else m = 0; s = t/100; lbela_time->Caption = Format("%2d : %2d : %2d", OPENARRAY(TVarRec, (h, m,s))); Update(); } } //--------------------------------------------------------------------------- void __fastcall TProgressForm::SetTitle(AnsiString Value) { lbTitle->Caption = Value; } //--------------------------------------------------------------------------- void __fastcall TProgressForm::FormShow(TObject *Sender) { Update(); } //---------------------------------------------------------------------------