home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / m_to_r / progbar / unit1.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  11.2 KB  |  462 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, TileBack,
  6.      StdCtrls, ExtCtrls, ProgBar, GrphFunc, Buttonex;
  7.  
  8. type
  9.   TForm1 = class(TForm)
  10.     ProgBar1: TProgBar;
  11.     ProgBar2: TProgBar;
  12.     ProgBar4: TProgBar;
  13.     ProgBar5: TProgBar;
  14.     ProgBar3: TProgBar;
  15.     ProgBar6: TProgBar;
  16.     ProgBar8: TProgBar;
  17.     ProgBar9: TProgBar;
  18.     ProgBar10: TProgBar;
  19.     ProgBar7: TProgBar;
  20.     Panel1: TPanel;
  21.     Button1: TButton;
  22.     Button2: TButton;
  23.     Button4: TButton;
  24.     Button5: TButton;
  25.     Button3: TButton;
  26.     Button6: TButton;
  27.     Button7: TButton;
  28.     RadioButton1: TRadioButton;
  29.     RadioButton2: TRadioButton;
  30.     RadioButton4: TRadioButton;
  31.     RadioButton3: TRadioButton;
  32.     Panel2: TPanel;
  33.     RadioButton5: TRadioButton;
  34.     RadioButton6: TRadioButton;
  35.     Panel3: TPanel;
  36.     RadioButton7: TRadioButton;
  37.     RadioButton8: TRadioButton;
  38.     Panel4: TPanel;
  39.     RadioButton9: TRadioButton;
  40.     RadioButton10: TRadioButton;
  41.     RadioButton11: TRadioButton;
  42.     ButtonExt1: TButtonExt;
  43.     Panel5: TPanel;
  44.     RadioButton12: TRadioButton;
  45.     RadioButton13: TRadioButton;
  46.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  47.     procedure Button2Click(Sender: TObject);
  48.     procedure Button1Click(Sender: TObject);
  49.     procedure Button3Click(Sender: TObject);
  50.     procedure Button4Click(Sender: TObject);
  51.     procedure Button5Click(Sender: TObject);
  52.     procedure Button6Click(Sender: TObject);
  53.     procedure Button7Click(Sender: TObject);
  54.     procedure RadioButton1Click(Sender: TObject);
  55.     procedure RadioButton2Click(Sender: TObject);
  56.     procedure RadioButton3Click(Sender: TObject);
  57.     procedure RadioButton4Click(Sender: TObject);
  58.     procedure RadioButton5Click(Sender: TObject);
  59.     procedure RadioButton6Click(Sender: TObject);
  60.     procedure RadioButton7Click(Sender: TObject);
  61.     procedure RadioButton8Click(Sender: TObject);
  62.     procedure RadioButton9Click(Sender: TObject);
  63.     procedure RadioButton10Click(Sender: TObject);
  64.     procedure RadioButton11Click(Sender: TObject);
  65.     procedure RadioButton12Click(Sender: TObject);
  66.     procedure RadioButton13Click(Sender: TObject);
  67.   private
  68.     procedure Go( ProgBar: TProgBar; var state: integer );
  69.   public
  70.     constructor Create( AOwner: TComponent ); override;
  71.     destructor  Destroy; override;
  72.   end;
  73.  
  74. var
  75.   State1    : integer;
  76.   State2    : integer;
  77.   State3    : integer;
  78.   State4    : integer;
  79.   State5    : integer;
  80.   State6    : integer;
  81.   State7    : integer;
  82.  
  83.   bitmap    : TBitmap;
  84.  
  85.   Form1     : TForm1;
  86.  
  87. implementation
  88.  
  89. {$R *.DFM}
  90.  
  91. constructor TForm1.Create( AOwner: TComponent );
  92. begin
  93.    inherited Create( AOwner );
  94.    bitmap := ButtonExt1.Bitmaps.Up;
  95. end;
  96.  
  97. destructor TForm1.Destroy;
  98. begin
  99.  
  100.    inherited Destroy;
  101. end;
  102.  
  103.  
  104. procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
  105. begin
  106.   Action := caFree;
  107. end;
  108.  
  109. procedure TForm1.Go( ProgBar : TProgBar; var state : integer );
  110. var 
  111.    i: integer;
  112. begin
  113.  
  114.    case state of 
  115.       0:
  116.        begin
  117.          for i:=0 to 100 do
  118.             Progbar.Value := i;
  119.          state := 1;
  120.        end;
  121.       1:
  122.        begin
  123.          for i:=0 to 50 do
  124.             Progbar.Value := i;
  125.            for i:=50 downto 33 do
  126.             Progbar.Value := i;
  127.            for i:=33 to  75 do
  128.             Progbar.Value := i;
  129.            for i:=75 downto 0 do
  130.             Progbar.Value := i;
  131.            for i:=0 to 100 do
  132.             Progbar.Value := i;
  133.    
  134.            state := 2;
  135.        end;
  136.       2:
  137.        begin
  138.            state := 0;
  139.          Progbar.Value := 0;
  140.        end;
  141.    end;
  142.  
  143. end;
  144.  
  145.  
  146. procedure TForm1.Button1Click(Sender: TObject);
  147. var
  148.    i: integer;
  149. begin
  150.  
  151.  
  152.    case State1 of 
  153.       0:
  154.        begin
  155.          ProgBar1.BarType := Normal;
  156.          ProgBar1.ForeColor:=clBlue;
  157.        end;
  158.       1:
  159.        begin
  160.          ProgBar1.BarType := Bar3D;
  161.          ProgBar1.ForeColor:=clBtnFace;
  162.        end;
  163.    end;
  164.  
  165.    Go( ProgBar1, State1 );
  166.  
  167. end;
  168.  
  169. procedure TForm1.Button2Click(Sender: TObject);
  170. var
  171.    i: integer;
  172. begin
  173.  
  174.    case State2 of 
  175.       0:
  176.        begin
  177.          ProgBar2.BarType := Normal;
  178.          ProgBar2.ForeColor:=clBlue;
  179.        end;
  180.       1:
  181.        begin
  182.          ProgBar2.BarType := Bar3D;
  183.          ProgBar2.ForeColor:=clBtnFace;
  184.        end;
  185.    end;
  186.  
  187.    Go( ProgBar2, State2 );
  188. end;
  189.  
  190. procedure TForm1.Button3Click(Sender: TObject);
  191. begin
  192.    Go( ProgBar3, State3 );
  193. end;
  194.  
  195. procedure TForm1.Button4Click(Sender: TObject);
  196. begin
  197.    Go( ProgBar4, State4 );
  198. end;
  199.  
  200. procedure TForm1.Button5Click(Sender: TObject);
  201. begin
  202.    Go( ProgBar5, State5 );
  203. end;
  204.  
  205. procedure TForm1.Button6Click(Sender: TObject);
  206. begin
  207.    Go( ProgBar6, State6 );
  208. end;
  209.  
  210. procedure TForm1.Button7Click(Sender: TObject);
  211. var
  212.    i: integer;
  213. begin
  214.  
  215.    case State7 of 
  216.       0:
  217.        begin
  218.          for i:=0 to 50 do
  219.          begin
  220.             Progbar7.Value  := i*2 ;
  221.             Progbar8.Value  := i*2 ;
  222.             Progbar9.Value  := i*2 ;
  223.             Progbar10.Value := i*2 ;
  224.          end;         
  225.          state7 := 1;
  226.        end;
  227.       1:
  228.        begin
  229.  
  230.          for i:=0 to 25 do
  231.          begin
  232.             Progbar7.Value  := i*2 ;
  233.             Progbar8.Value  := i*2 ;
  234.             Progbar9.Value  := i*2 ;
  235.             Progbar10.Value := i*2 ;
  236.          end;         
  237.            for i:=25 downto 22 do
  238.          begin
  239.             Progbar7.Value  := i*2 ;
  240.             Progbar8.Value  := i*2 ;
  241.             Progbar9.Value  := i*2 ;
  242.             Progbar10.Value := i*2 ;
  243.          end;         
  244.            for i:=22 to  38 do
  245.          begin
  246.             Progbar7.Value  := i*2 ;
  247.             Progbar8.Value  := i*2 ;
  248.             Progbar9.Value  := i*2 ;
  249.             Progbar10.Value := i*2 ;
  250.          end;      
  251.            for i:=38 downto 0 do
  252.          begin
  253.             Progbar7.Value  := i*2 ;
  254.             Progbar8.Value  := i*2 ;
  255.             Progbar9.Value  := i*2 ;
  256.             Progbar10.Value := i*2 ;
  257.          end;      
  258.            for i:=0 to 50 do
  259.          begin
  260.             Progbar7.Value  := i*2 ;
  261.             Progbar8.Value  := i*2 ;
  262.             Progbar9.Value  := i*2 ;
  263.             Progbar10.Value := i*2 ;
  264.          end;      
  265.    
  266.            State7 := 2;
  267.        end;
  268.       2:
  269.        begin
  270.            State7 := 0;
  271.          Progbar7.Value  := 0 ;
  272.          Progbar8.Value  := 0 ;
  273.          Progbar9.Value  := 0 ;
  274.          Progbar10.Value := 0 ;
  275.        end;
  276.    end;
  277.  
  278. end;
  279.  
  280. procedure TForm1.RadioButton1Click(Sender: TObject);
  281. begin
  282.          Progbar7.bitmap  := nil;
  283.          Progbar8.bitmap  := nil;
  284.          Progbar9.bitmap  := nil;
  285.          Progbar10.bitmap := nil;
  286.  
  287.          Progbar7.BarType  := Normal;
  288.          Progbar8.BarType  := Normal;
  289.          Progbar9.BarType  := Normal;
  290.          Progbar10.BarType := Normal;
  291.  
  292.          ProgBar7.ForeColor  := clBlue;
  293.          ProgBar8.ForeColor  := clBlue;
  294.          ProgBar9.ForeColor  := clBlue;
  295.          ProgBar10.ForeColor := clBlue;
  296.  
  297.          ProgBar7.BackColor  := clBtnFace;
  298.          ProgBar8.BackColor  := clBtnFace;
  299.          ProgBar9.BackColor  := clBtnFace;
  300.          ProgBar10.BackColor := clBtnFace;
  301.  
  302. end;
  303.  
  304. procedure TForm1.RadioButton2Click(Sender: TObject);
  305. begin
  306.          Progbar7.bitmap  := nil;
  307.          Progbar8.bitmap  := nil;
  308.          Progbar9.bitmap  := nil;
  309.          Progbar10.bitmap := nil;
  310.  
  311.          Progbar7.BarType  := Bar3D;
  312.          Progbar8.BarType  := Bar3D;
  313.          Progbar9.BarType  := Bar3D;
  314.          Progbar10.BarType := Bar3D;
  315.  
  316.          ProgBar7.ForeColor  := clBtnFace;
  317.          ProgBar8.ForeColor  := clBtnFace;
  318.          ProgBar9.ForeColor  := clBtnFace;
  319.          ProgBar10.ForeColor := clBtnFace;
  320.  
  321.          ProgBar7.BackColor  := clBtnFace;
  322.          ProgBar8.BackColor  := clBtnFace;
  323.          ProgBar9.BackColor  := clBtnFace;
  324.          ProgBar10.BackColor := clBtnFace;
  325.  
  326. end;
  327.  
  328. procedure TForm1.RadioButton3Click(Sender: TObject);
  329. begin
  330.          Progbar7.bitmap  := bitmap;
  331.          Progbar8.bitmap  := bitmap;
  332.          Progbar9.bitmap  := bitmap;
  333.          Progbar10.bitmap := bitmap;
  334.  
  335.          Progbar7.BarType  := Bar3D;
  336.          Progbar8.BarType  := Bar3D;
  337.          Progbar9.BarType  := Bar3D;
  338.          Progbar10.BarType := Bar3D;
  339.  
  340.          ProgBar7.ForeColor  := clBtnFace;
  341.          ProgBar8.ForeColor  := clBtnFace;
  342.          ProgBar9.ForeColor  := clBtnFace;
  343.          ProgBar10.ForeColor := clBtnFace;
  344.  
  345.          ProgBar7.BackColor  := clBtnFace;
  346.          ProgBar8.BackColor  := clBtnFace;
  347.          ProgBar9.BackColor  := clBtnFace;
  348.          ProgBar10.BackColor := clBtnFace;
  349.  
  350.  
  351. end;
  352.  
  353. procedure TForm1.RadioButton4Click(Sender: TObject);
  354. begin
  355.          Progbar7.bitmap  := nil;
  356.          Progbar8.bitmap  := nil;
  357.          Progbar9.bitmap  := nil;
  358.          Progbar10.bitmap := nil;
  359.  
  360.          Progbar7.BarType  := LED;
  361.          Progbar8.BarType  := LED;
  362.          Progbar9.BarType  := LED;
  363.          Progbar10.BarType := LED;
  364.  
  365.          ProgBar7.BackColor  := clBlack;
  366.          ProgBar8.BackColor  := clBlack;
  367.          ProgBar9.BackColor  := clBlack;
  368.          ProgBar10.BackColor := clBlack;
  369.        
  370.  
  371. end;
  372.  
  373. procedure TForm1.RadioButton5Click(Sender: TObject);
  374. begin
  375.          ProgBar7.BarShape  := Rectangular;
  376.          ProgBar8.BarShape  := Rectangular;
  377.          ProgBar9.BarShape  := Rectangular;
  378.          ProgBar10.BarShape := Rectangular;
  379.  
  380.  
  381. end;
  382.  
  383. procedure TForm1.RadioButton6Click(Sender: TObject);
  384. begin
  385.          ProgBar7.BarShape  := Trapezoidal;
  386.          ProgBar8.BarShape  := Trapezoidal;
  387.          ProgBar9.BarShape  := Trapezoidal;
  388.          ProgBar10.BarShape := Trapezoidal;
  389.  
  390. end;
  391.  
  392. procedure TForm1.RadioButton7Click(Sender: TObject);
  393. begin
  394.    ProgBar7.TrapezoidDir := LargeToSmall;
  395.    ProgBar8.TrapezoidDir := LargeToSmall;
  396.    ProgBar9.TrapezoidDir := LargeToSmall;
  397.    ProgBar10.TrapezoidDir := LargeToSmall;
  398.  
  399. end;
  400.  
  401. procedure TForm1.RadioButton8Click(Sender: TObject);
  402. begin
  403.    ProgBar7.TrapezoidDir := SmallToLarge;
  404.    ProgBar8.TrapezoidDir := SmallToLarge;
  405.    ProgBar9.TrapezoidDir := SmallToLarge;
  406.    ProgBar10.TrapezoidDir := SmallToLarge;
  407.  
  408. end;
  409.  
  410. procedure TForm1.RadioButton9Click(Sender: TObject);
  411. begin
  412.    ProgBar7.TrapezoidShape  := TSLeft;
  413.    ProgBar8.TrapezoidShape  := TSLeft;
  414.    ProgBar9.TrapezoidShape  := TSLeft;
  415.    ProgBar10.TrapezoidShape := TSLeft;
  416.  
  417. end;
  418.  
  419. procedure TForm1.RadioButton10Click(Sender: TObject);
  420. begin
  421.    ProgBar7.TrapezoidShape  := TSCenter;
  422.    ProgBar8.TrapezoidShape  := TSCenter;
  423.    ProgBar9.TrapezoidShape  := TSCenter;
  424.    ProgBar10.TrapezoidShape := TSCenter;
  425.  
  426. end;
  427.  
  428. procedure TForm1.RadioButton11Click(Sender: TObject);
  429. begin
  430.    ProgBar7.TrapezoidShape  := TSRight;
  431.    ProgBar8.TrapezoidShape  := TSRight;
  432.    ProgBar9.TrapezoidShape  := TSRight;
  433.    ProgBar10.TrapezoidShape := TSRight;
  434.  
  435. end;
  436.  
  437. procedure TForm1.RadioButton12Click(Sender: TObject);
  438. var
  439.    i : integer;
  440. begin
  441.  
  442.    for i:=0 to componentCount -1 do
  443.     begin
  444.       if (Components[ i ] is TProgbar) then
  445.          TProgbar( Components[ i ]).ShowText := True;
  446.     end;
  447. end;
  448.  
  449. procedure TForm1.RadioButton13Click(Sender: TObject);
  450. var
  451.    i : integer;
  452. begin
  453.  
  454.    for i:=0 to componentCount -1 do
  455.     begin
  456.       if (Components[ i ] is TProgbar) then
  457.          TProgbar( Components[ i ]).ShowText := False;
  458.     end;
  459. end;
  460.  
  461. end.
  462.