unit1.~pas

来自「本范例采用TPaintBox控件派生出仪表控件。 文件说明:PaintGrid」· ~PAS 代码 · 共 53 行

~PAS
53
字号
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, PaintGrid;

type
  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Timer1: TTimer;
    Panel1: TPanel;
    Image1: TImage;
    PaintGrid1: TPaintGrid;
    Label1: TLabel;
    Label2: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  iTime:integer;

implementation

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  Timer1.Enabled := Not Timer1.Enabled;

end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  V1,V2:integer;
begin
   V1 :=  50+Random(200);
   V2 := 50+Random(200);
   PaintGrid1.PaintTime(V1,V2);
   Label1.Caption := inttostr(V1);
   Label2.Caption := inttostr(V2);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?