美文网首页
2018-10-13 progressbar 的填充控制

2018-10-13 progressbar 的填充控制

作者: netppp | 来源:发表于2018-10-13 16:41 被阅读0次

    用了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 的填充控制

          本文链接:https://www.haomeiwen.com/subject/oowoaftx.html