2018-10-13 progressbar 的填充控制

用了clx中的组件


unit Unit1;

interface

uses

  SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms,

  QDialogs, QStdCtrls, QComCtrls;

type

  TForm1 = class(TForm)

    ProgressBar1: TProgressBar;

    Button1: TButton;

    procedure Button1Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  Form1: TForm1;

implementation

{$R *.xfm}

procedure TForm1.Button1Click(Sender: TObject);

var i:Integer;

begin

      progressbar1.Min:=0;

      progressbar1.Max:=100;

      progressbar1.step:=1;

      progressbar1.smooth:=true;

      progressbar1.showcaption:=true;

      for i:=0 to 100  do

        begin

          progressbar1.caption:=inttostr(i)+'%';

          case i of

          0..25:  progressbar1.fillcolor:=clred;

          26..50:  progressbar1.fillcolor:=clblack;

            51..75:  progressbar1.fillcolor:=clgreen;

          76..100:  progressbar1.fillcolor:=clyellow;

        end;

          progressbar1.stepit;

          Sleep(100);

    end;

      progressbar1.caption:='';

end;

end.

你可能感兴趣的:(2018-10-13 progressbar 的填充控制)