⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 treetransit.pas

📁 第三方控件:PaintGrid.pas 网格型仪表控件源文件 Mymeter.pas 圆型仪表控件源文件 Project1是这两个控件的使用范例。 该
💻 PAS
字号:
{***********************************************}
{   TTree Component - Transit Shapes            }
{   Copyright (c) 2001-2002 by David Berneda    }
{***********************************************}
{$I TeeDefs.inc}
unit TreeTransit;

{ Several custom shapes used in streets and roads... }
interface

Uses {$IFNDEF LINUX}
     Windows,
     {$ENDIF}
     Classes,
     {$IFDEF CLX}
     QGraphics, Types, QControls,
     {$ELSE}
     Graphics, Controls,
     {$ENDIF}
     TeeTree, TreeFlow, TeCanvas;

type TTransitShape=class(TCustomTreeShape);

     TStopShape=class(TOctagonShape)
     public
       Constructor Create(AOwner: TComponent); override;
       Procedure RecalcSize(ACanvas:TCanvas3D); override;
     published
       property Color default clRed;
     end;

     TYieldShape=class(TTransitShape)
     public
       Constructor Create(AOwner: TComponent); override;
     published
       property Color default clYellow;
       property Style default tssTriangleBottom;
     end;

     TSlowShape=class(TTransitShape)
     public
       Constructor Create(AOwner: TComponent); override;
     published
       property Color default clYellow;
       property Style default tssDiamond;
     end;

     TDangerShape=class(TTransitShape)
     public
       Constructor Create(AOwner: TComponent); override;
     published
       property Color default clRed;
       property Style default tssDiamond;
     end;

implementation

Uses TreeConst;

{ TStopShape }

constructor TStopShape.Create(AOwner: TComponent);
begin
  inherited;
  Color:=clRed;
  Border.Color:=clWhite;
  Font.Color:=clWhite;
  Font.Style:=[fsBold];
  Text.Clear;
  Text.Add('STOP');
end;

procedure TStopShape.RecalcSize(ACanvas:TCanvas3D);
var tmp : Integer;
begin
  inherited;
  tmp:=Width;
  tmp:=Round(1.1*tmp);
  Height:=tmp;
  Width:=tmp;
  ChangeAutoSize(True);
end;

{ TYieldShape }

constructor TYieldShape.Create(AOwner: TComponent);
begin
  inherited;
  Border.Color:=clBlack;
  Border.Visible:=True;
  Color:=clYellow;
  Style:=tssTriangleBottom;
  Text.Clear;
  Text.Add('YIELD');
end;

{ TSlowShape }

constructor TSlowShape.Create(AOwner: TComponent);
begin
  inherited;
  Color:=clYellow;
  Style:=tssDiamond;
  Font.Style:=[fsBold];
  Text.Clear;
  Text.Add('SLOW');
end;

{ TDangerShape }

constructor TDangerShape.Create(AOwner: TComponent);
begin
  inherited;
  Color:=clRed;
  Style:=tssDiamond;
  Font.Color:=clWhite;
  Text.Clear;
  Text.Add('DANGER');
end;

initialization
  RegisterCustomTreeShape(TeeTree_tabTransit, 'Stop', TStopShape);
  RegisterCustomTreeShape(TeeTree_tabTransit, 'Yield', TYieldShape);
  RegisterCustomTreeShape(TeeTree_tabTransit, 'Slow', TSlowShape);
  RegisterCustomTreeShape(TeeTree_tabTransit, 'Danger', TDangerShape);
finalization
  UnRegisterCustomTreeShapes([ TStopShape, TYieldShape, TSlowShape,
                               TDangerShape ]);
end.

⌨️ 快捷键说明

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