📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, PaintGrid, Mymeter;
type
TForm1 = class(TForm)
BitBtn2: TBitBtn;
Timer1: TTimer;
Panel1: TPanel;
Image1: TImage;
PaintGrid1: TPaintGrid;
Label1: TLabel;
Label2: TLabel;
Mymeter1: TMymeter;
Mymeter2: TMymeter;
Mymeter3: TMymeter;
Edit2: TEdit;
procedure BitBtn1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn2Click(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;
procedure TForm1.FormCreate(Sender: TObject);
begin
//使用示范开始
with Mymeter1 do
begin
Mymeter1.A1:=75; //定义刻度第一段的角度
A2:=15; //定义刻度第二段的角度
ColorA1:=clLime; //定义刻度第一段的色彩
ColorA2:= Clred; //定义刻度第二段的色彩
minvalue := 20.0; //最小值
maxvalue := 90.0; //最大值
strUint :='Vac';
Xwidth := Width;
YHeight := Height;
Paint;
end;
// Mymeter1.wi
//使用示范开始
with Mymeter2 do
begin
A1:=65; //定义刻度第一段的角度
A2:=25; //定义刻度第二段的角度
ColorA1:=clLime; //定义刻度第一段的色彩
ColorA2:= Clred; //定义刻度第二段的色彩
minvalue := 0.0; //最小值
maxvalue := 300.0; //最大值
strUint :='A';
Xwidth := Width;
YHeight :=Height;
Paint;
end;
//使用示范开始
with Mymeter3 do
begin
A1:=65; //定义刻度第一段的角度
A2:=25; //定义刻度第二段的角度
ColorA1:=clLime; //定义刻度第一段的色彩
ColorA2:= Clred; //定义刻度第二段的色彩
minvalue := 0; //最小值
maxvalue := 100; //最大值
strUint :='A';
Xwidth := Width;
YHeight := Height;
IstemperatureMeter:= True; //温度仪表
Paint;
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Mymeter1.MyPaint(strtofloat(edit2.Text)); //画指针
Mymeter2.MyPaint(strtofloat(edit2.Text)); //画指针
Mymeter3.MyPaint(strtofloat(edit2.Text)); //画指针
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -