zoukankan      html  css  js  c++  java
  • 通过例子来简单了解下TProgressBar的使用。 pas文件程序如下

    unit Unit4;
     
    interface
     
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ComCtrls;
     
    type
      TForm4 = class(TForm)
        progress: TProgressBar;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
     
    var
      Form4: TForm4;
     
    implementation
     
    {$R *.dfm}
     
    procedure TForm4.FormCreate(Sender: TObject);
    var
      I: Integer;
    begin
      try
        progress.Max := 100;
        for I := 0 to 100 - 1 do
        begin
          Application.ProcessMessages;
          progress.Position := I;
          Sleep(50);
        end;
      finally
        //progress.Max := 0;
      end;
      
    end;
     
    end.

    fram文件如下:

    object Form4: TForm4
      Left = 0
      Top = 0
      Caption = 'Form4'
      ClientHeight = 300
      ClientWidth = 635
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object progress: TProgressBar
        Left = 0
        Top = 283
        Width = 635
        Height = 17
        Align = alBottom
        TabOrder = 0
      end
    end

    实际运行结果如图所示:

     以上程序即可简单的使用TProgressBar。

  • 相关阅读:
    c++:函数模板
    1084 外观数列
    1083 是否存在相等的差
    1082 射击比赛
    1081 检查密码
    1080 MOOC期终成绩
    1079 延迟的回文数
    1078 字符串压缩与解压
    1077 互评成绩计算
    1076 Wifi密码
  • 原文地址:https://www.cnblogs.com/jijm123/p/12602675.html
Copyright © 2011-2022 走看看