線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1375
推到 Plurk!
推到 Facebook!

[轉貼]在StatusBar中顯示進度條和Insert鍵的狀態

 
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-08-16 09:09:34 IP:61.218.xxx.xxx 未訂閱

在StatusBar中顯示進度條和Insert鍵的狀態

作者:水木清華 資料來源:盤絲洞
             #include  
             #pragma hdrstop 
 
             #include "Unit1.h" 
            //--------------------------------------------------------------------------- 
             
             #pragma package(smart_init) 
             #pragma resource "*.dfm" 
             TForm1 *Form1; 
            //--------------------------------------------------------------------------- 
        
             void__fastcall TForm1::TForm1(TComponent* Owner) 
               : TForm(Owner) 
             { 
             } 
            //---------------------------------------------------------------------------                  void __fastcall TForm1::FormCreate(TObject *Sender) 
             { 
                 ProgressBar = new TProgressBar ( StatusBar1 ); 
                 ProgressBar->Parent = StatusBar1; 
 
                 ProgressBar->Position = 0; 
                 ProgressBar->Visible = false; 
             } 
             //---------------------------------------------------------------------------                  void __fastcall TForm1::StatusBar1Resize(TObject *Sender) 
             { 
                 int Size = StatusBar1->Width; 
                 for ( int i = 1; i < StatusBar1->Panels->Count; i   ) 
                   Size -= StatusBar1->Panels->Items[i]->Width; 
 
                 //resize the first panel based on the form width 
                 StatusBar1->Panels->Items[ 0 ]->Width = Size; 
                 RECT Rect; 
                 StatusBar1->Perform ( SB_GETRECT,  0,  (LPARAM)&Rect ); 
 
                 ProgressBar->Top = Rect.top; 
                 ProgressBar->Left = Rect.left; 
                 ProgressBar->Width = StatusBar1->Panels->Items [ 0 ]->Width; 
                 ProgressBar->Height = Rect.bottom - Rect.top; 
             } 
            //--------------------------------------------------------------------------- 
          
             void __fastcall TForm1::Button1Click(TObject *Sender) 
             { 
               ProgressBar->Show(); 
               ProgressBar->Position = 50;   
             } 
            //--------------------------------------------------------------------------- 
            
 
             Here is Unit1.h 
 
            //--------------------------------------------------------------------------- 
          
             #ifndef Unit1H 
             #define Unit1H 
             //--------------------------------------------------------------------------- 
         
             #include  
             #include  
             #include  
             #include  
             #include  
            //--------------------------------------------------------------------------- 
          
             class TForm1 : public TForm 
             { 
             __published:    // IDE-managed Components 
               TStatusBar *StatusBar1; 
               TButton *Button1; 
               void __fastcall FormCreate(TObject *Sender); 
               void __fastcall StatusBar1Resize(TObject *Sender); 
               void __fastcall Button1Click(TObject *Sender); 
             private:        // User declarations 
               TProgressBar *ProgressBar; 
             public:         // User declarations 
               __fastcall TForm1(TComponent* Owner); 
             }; 
            //--------------------------------------------------------------------------- 
          
             extern PACKAGE TForm1 *Form1; 
            //--------------------------------------------------------------------------- 
         
             #endif 
時間就是金錢---[ 發問前請先找找舊文章] 發表人 - axsoft 於 2002/08/16 09:12:04
系統時間:2024-04-19 11:29:56
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!