Progress bars. Using them for other things. |
|
axsoft
版主 發表:681 回覆:1056 積分:969 註冊:2002-03-13 發送簡訊給我 |
Progress bars. Using them for other things.http://www.hobbypages.net/snip14.html Here are a few things you can use progress bars for. These are useful in your About Dialog Showing memory load. Showing disk usage. For a Memory Meter:void TForm1::UpDateMemMeter() { MEMORYSTATUS memory; memory.dwLength = sizeof (memory); GlobalMemoryStatus (&memory); ProgressBar1->Position = (float) memory.dwMemoryLoad; Label1->Caption = String ((int) (memory.dwMemoryLoad )) "% Memory Load"; Label4->Caption = FloatToStr(memory.dwTotalPhys / 1024) " Kb Installed RAM"; } And for the Disk Meter: void TForm1::UpDateDrvMeter() { Label2->Caption = IntToStr (((DiskSize(0) / 1024) - (DiskFree(0) / 1024)) / 1024) " Mb used space."; ProgressBar2->Position = (100.0 * (DiskSize(0) - DiskFree(0)) / DiskSize(0)); Label3->Caption = IntToStr((DiskSize(0) / 1024) / 1024) " Mb on this drive."; } Use a timer to load and update the meters: void __fastcall TForm1::Timer1Timer(TObject *Sender) { UpDateMemMeter(); UpDateDrvMeter(); }網路志工聯盟----Visita網站http://www.vista.org.tw ---[ 發問前請先找找舊文章 ]--- 發表人 - axsoft 於 2003/03/31 13:54:46 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |