自己项目用的一个控件,自己封装的

unit rzpanelEX;

interface

uses
  SysUtils, Classes, Controls, ExtCtrls, RzPanel,RzLabel,Graphics,RzCommon;

type
  trzpanelEX = class(TRzPanel)
  private

    label_top :TRzLabel;
    label_bg :TRzLabel;
    label_wd :TRzLabel;
    label_sd :TRzLabel;
    label_wdfh,label_sdfh:TRzLabel;
    label_tip1,label_tip2:TRzLabel;
    procedure SetTopText(const value :string);
    function ReadTopText():string;
    function SetDevStatus(value :Boolean):Boolean;
    procedure SetWD(const value:string);
    procedure SetSD(const value:string);
    function ReadWD():string;
    function ReadSD():string;
    function ReadTip1: string;
    function ReadTip2: string;
    procedure SetTip1(const Value: string);
    procedure SetTip2(const Value: string);
  protected
    { Protected declarations }
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;


  published
    { Published declarations }
    property UTopText:string read ReadTopText write SetTopText;
    property UWDValue:string read ReadWD write SetWD;
    property USDValue:string read ReadSD write SetSD;
    property UTip1value:string read ReadTip1 write SetTip1;
    property UTip2value:string read ReadTip2 write SetTip2;
    procedure SetWDColor(value :Integer);
    procedure SetSDColor(value :Integer);
    //property NullDev:Boolean read SetDevStatus write SetDevStatus;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [trzpanelEX]);
end;

{ trzpanelEX }

constructor trzpanelEX.Create(AOwner: TComponent);
begin
  inherited;
  label_bg := TRzLabel.Create(Self);
  label_bg.Parent := Self;
  label_bg.Left := 2;
  label_bg.Top := 39;
  label_bg.Width := 146;
  label_bg.Height := 72;
  label_bg.AutoSize := False;
  label_bg.Color := $00F0F4F0;
  label_bg.ParentColor := False;
  //label_bg.BringToFront := True;
  label_top := TRzLabel.Create(Self);
  
  label_top.Parent := Self;
  label_top.Left := 8 ;
  label_top.Top := 8;
  label_top.Width := 137;
  label_top.Height := 25;
  label_top.Alignment := taCenter;
  label_top.AutoSize := False;
  label_top.BiDiMode := bdLeftToRight;
  label_top.Caption := #27979#28857'1';
  label_top.Font.Charset := 0;
  label_top.Font.Color := clWindowText;
  label_top.Font.Height := -16;
  label_top.Font.Name := #23435#20307;
  label_top.Font.Style := [];
  label_top.ParentBiDiMode := False;
  label_top.ParentFont := False;
  label_top.Caption := '测点1';

  label_wd := TRzLabel.Create(Self);
  label_wd.Parent := Self;
  label_wd.Left := 43;
  label_wd.Top := 53;
  label_wd.Width := 52;
  label_wd.Height := 16;
  label_wd.AutoSize := False;
  label_wd.Caption := '26.5';
  label_wd.Color := 15791344;
  label_wd.Font.Charset := 0;
  label_wd.Font.Color := clWindowText;
  label_wd.Font.Height := -16;
  label_wd.Font.Name := #23435#20307;
  label_wd.Font.Style := [fsBold];
  label_wd.ParentColor := False;
  label_wd.ParentFont := False;

  label_sd := TRzLabel.Create(Self);
  label_sd.Parent := Self;
  label_sd.Left := 43;
  label_sd.Top := 80;
  label_sd.Width := 52;
  label_sd.Height := 16;
  label_sd.AutoSize := False;
  label_sd.Caption := '45.3';
  label_sd.Color := 15791344;
  label_sd.Font.Charset := 0;
  label_sd.Font.Color := clWindowText;
  label_sd.Font.Height := -16;
  label_sd.Font.Name := #23435#20307;
  label_sd.Font.Style := [fsBold];
  label_sd.ParentColor := False;
  label_sd.ParentFont := False;

  label_wdfh := TRzLabel.Create(Self);
  label_wdfh.Parent := Self;
  label_wdfh.Left := 104;
  label_wdfh.Top := 53;
  label_wdfh.Width := 23;
  label_wdfh.Height := 16;
  label_wdfh.AutoSize := False;
  label_wdfh.Caption := #8451;
  label_wdfh.Color := 15791344;
  label_wdfh.Font.Charset := 0;
  label_wdfh.Font.Color := clWindowText;
  label_wdfh.Font.Height := -16;
  label_wdfh.Font.Name := #23435#20307;
  label_wdfh.Font.Style := [fsBold];
  label_wdfh.ParentColor := False;
  label_wdfh.ParentFont := False;

  label_sdfh := TRzLabel.Create(Self);
  label_sdfh.Parent := Self;
  label_sdfh.Left := 104;
  label_sdfh.Top := 80;
  label_sdfh.Width := 40;
  label_sdfh.Height := 16;
  label_sdfh.AutoSize := False;
  label_sdfh.Caption := '%  ';
  label_sdfh.Color := 15791344;
  label_sdfh.Font.Charset := 0;
  label_sdfh.Font.Color := clWindowText;
  label_sdfh.Font.Height := -16;
  label_sdfh.Font.Name := #23435#20307;
  label_sdfh.Font.Style := [fsBold];
  label_sdfh.ParentColor := False;
  label_sdfh.ParentFont := False;

  label_tip1 := TRzLabel.Create(Self);
  label_tip1.Parent := Self;
  label_tip1.Left := 8;
  label_tip1.Top := 116;
  label_tip1.Width := 65;
  label_tip1.Height := 13;
  label_tip1.AutoSize := False;
  label_tip1.Caption := 'SP1 23';

  label_tip2 := TRzLabel.Create(Self);
  label_tip2.Parent := Self;
  label_tip2.Left := 8;
  label_tip2.Top := 132;
  label_tip2.Width := 65;
  label_tip2.Height := 13;
  label_tip2.AutoSize := False;
  label_tip2.Caption := 'SP2 100';

  Width := 150;
  Height := 150;
  Color := $00F8E8C7;
  BorderInner := fsFlatRounded;
  BorderOuter := fsNone;
end;

destructor trzpanelEX.Destroy;
begin

  inherited;
end;


function trzpanelEX.ReadSD: string;
begin
  Result := label_sd.caption;
end;


function trzpanelEX.ReadTopText: string;
begin
  Result := label_top.Caption;
end;

function trzpanelEX.ReadWD: string;
begin
  Result := label_wd.Caption;
end;

function trzpanelEX.SetDevStatus(value: Boolean): Boolean;
begin
  if value then
  begin

  end
  else
  begin

  end;
  Result := value;   
end;

procedure trzpanelEX.SetSD(const value: string);
begin
  label_sd.Caption := value;
end;

function trzpanelEX.ReadTip1: string;
begin
  Result := label_tip1.Caption;
end;

function trzpanelEX.ReadTip2: string;
begin
  Result := label_tip2.Caption;
end;
procedure trzpanelEX.SetTip1(const Value: string);
begin
  label_tip1.Caption := Value;
end;

procedure trzpanelEX.SetTip2(const Value: string);
begin
  label_tip2.Caption := Value;
end;

procedure trzpanelEX.SetTopText(const value: string);
begin
  label_top.Caption := value;
end;

procedure trzpanelEX.SetWD(const value: string);
begin
  label_wd.Caption := value;
end;

procedure trzpanelEX.SetWDColor(value: Integer);
begin
  label_wd.Font.Color := value;
end;

procedure trzpanelEX.SetSDColor(value: Integer);
begin
  label_sd.Font.Color := value;
end;

end.

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭