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

📄 tecanvas.pas

📁 TeeChart7Source 控件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{**********************************************}
{   TeeChart and TeeTree TCanvas3D component   }
{   Copyright (c) 1999-2004 by David Berneda   }
{        All Rights Reserved                   }
{**********************************************}
unit TeCanvas;
{$I TeeDefs.inc}

interface

{$DEFINE TEEWINDOWS}
{$DEFINE TEEPLANEFLOAT}  // optimize TCanvas3D.PlaneFour3D method

Uses {$IFNDEF LINUX}
     {$IFDEF TEEWINDOWS}
     Windows,
     {$ENDIF}
     {$IFDEF TEEVCL}
     Messages,
     {$ENDIF}
     {$ENDIF}
     {$IFDEF TEEVCL}
     Classes, SysUtils,
     {$ENDIF}
     {$IFDEF CLX}
     Qt, QGraphics, QStdCtrls, QControls, QComCtrls, Types,
     {$ELSE}
     {$IFDEF TEEVCL}
     Controls, StdCtrls, Graphics,
     {$ENDIF}
     {$ENDIF}

     {$IFDEF CLR}
     System.ComponentModel,
     {$ENDIF}

     TypInfo;

Const
  TeePiStep:Double      = Pi/180.0;

  {$NODEFINE TeePiStep}  { for C++ Builder }

  TeeDefaultPerspective = 15;
  TeeMinAngle           = 270;

  {$IFNDEF D6}
  clMoneyGreen = TColor($C0DCC0);
  clSkyBlue    = TColor($F0CAA6);
  clCream      = TColor($F0FBFF);
  clMedGray    = TColor($A4A0A0);
  {$ENDIF}

  {$IFDEF CLX}
  clMoneyGreen = TColor($C0DCC0);
  clSkyBlue    = TColor($F0CAA6);
  clCream      = TColor($F0FBFF);
  clMedGray    = TColor($A4A0A0);

  {$IFDEF LINUX}
  TA_LEFT   = 0;
  TA_RIGHT  = 2;
  TA_CENTER = 6;
  TA_TOP    = 0;
  TA_BOTTOM = 8;

  PATCOPY      = 0;
  {$ENDIF}
  {$ENDIF}

  NumCirclePoints = 64;

  {$IFNDEF TEEWINDOWS}
  DEFAULT_CHARSET = 1;
  ANTIALIASED_QUALITY = 4;
  TA_LEFT = 0;

  bs_Solid=0;
  {$ENDIF}

  {$IFNDEF TEEVCL}
  clGray=0;
  clDkGray=0;
  clWhite=$FFFFFF;
  clSilver=0;
  clDefault=-1;
  clNone=-2;
  clBlack=0;
  clYellow=$FFFF;

  pf24Bit=0;
  pfDevice=1;

  CM_MOUSELEAVE=10000;
  CM_SYSCOLORCHANGE=10001;
  {$ENDIF}

var
  TeeDefaultConePercent : Integer=0;

type
     {$IFNDEF TEEWINDOWS}
     TPoint=packed record
       X,Y: Integer;
     end;

     TRect = packed record
       case Integer of
         0: (Left, Top, Right, Bottom: Integer);
         1: (TopLeft, BottomRight: TPoint);
     end;

     HDC=Integer;
     HPen=Integer;
     HRgn=Integer;

     TRGBTRIPLE = packed record
       rgbtBlue: Byte;
       rgbtGreen: Byte;
       rgbtRed: Byte;
     end;

     COLORREF = LongWord;

     TLogBrush=packed record
       lbStyle:Integer;
       lbColor:TColor;
       lbHatch:Integer;
     end;
     {$ENDIF}

     {$IFNDEF TEEVCL}
     {$DEFINE TEECANVASLOCKS}

     TNotifyEvent = procedure(Sender: TObject) of object;

     TPersistent = class(TObject)
     public
       Procedure Assign(Source:TPersistent); virtual;
     end;

     TComponent=class(TPersistent);

     TCreateParams=class
     end;

     TColor=Integer;
     PColor = ^TColor;

     TGraphicObject=class(TPersistent)
     private
       FOnChange : TNotifyEvent;
     public
       procedure Changed;
       property OnChange:TNotifyEvent read FOnChange write FOnChange;
     end;

     TPenStyle=(psSolid,psDash,psDot,psDashDot,psDashDotDot,psClear,psInsideFrame);

     TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy,
      pmMergePenNot, pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,
      pmNotMerge, pmMask, pmNotMask, pmXor, pmNotXor);

     TPen=class(TGraphicObject)
     private
       FColor : TColor;
       FStyle : TPenStyle;
       FWidth : Integer;
       FMode : TPenMode;
       FOnChange : TNotifyEvent;
     public
       Handle : HPen;
       property Color: TColor read FColor write FColor;
       property Mode:TPenMode read FMode write FMode;
       property Style: TPenStyle read FStyle write FStyle;
       property Width: Integer read FWidth write FWidth;
     end;

     TGraphic=class(TPersistent)
     public
       Palette : Integer;
       Width, Height : Integer;
       Empty : Boolean;
     end;

     PByteArray = ^TByteArray;
     TByteArray = array[0..32767] of Byte;

     TCanvas=class;

     {$IFNDEF VCL}
     TRGBTripleArray=packed array[0..0] of TRGBTriple;
     {$ENDIF}

     TBitmap=class(TGraphic)
     private
     public
       PixelFormat : Integer;
       IgnorePalette : Boolean;
       Canvas : TCanvas;
       ScanLine:Array of Pointer;
     end;

     TPicture=class(TGraphicObject)
     public
       Graphic:TGraphic;
       Bitmap:TBitmap;
     end;

     TBrushStyle=(bsClear, bsSolid,bsDiagonal);

     TBrush=class(TGraphicObject)
     private
       FColor : TColor;
       FBitmap : TBitmap;
       FStyle : TBrushStyle;
     public
       Handle : HBrush;

       property Bitmap:TBitmap read FBitmap write FBitmap;
       property Color: TColor read FColor write FColor;
       property Style: TBrushStyle read FStyle write FStyle;
     end;

     TFontStyle=(fsBold, fsItalic, fsUnderline, fsStrikeThrough);
     TFontStyles=set of TFontStyle;

     TFont=class(TGraphicObject)
     private
       FColor : TColor;
       FHeight : Integer;
       FName : String;
       FStyle : TFontStyles;
       FSize: Integer;
       FSet   : Integer;
     public
       PixelsPerInch : Integer;
       Handle : HFont;

       property CharSet : Integer read FSet write FSet;
       property Color: TColor read FColor write FColor;
       property Height : Integer read FHeight write FHeight;
       property Name : String read FName write FName;
       property Size:Integer read FSize write FSize;
       property Style:TFontStyles read FStyle write FStyle;
     end;

     TCanvas=class(TObject)
     private
       FOnChange:TNotifyEvent;
       FOnChanging:TNotifyEvent;
       function GetPixel(X, Y: Integer): TColor;
       procedure SetPixel(X, Y: Integer; Value: TColor);
     public
       Pen:TPen;
       Brush:TBrush;
       Font:TFont;
       Handle : HDC;
       procedure CopyRect(const Dest: TRect; Canvas: TCanvas; const Source: TRect);
       function TextExtent(const Text: string): TSize;
       property OnChange:TNotifyEvent read FOnChange write FOnChange;
       property OnChanging:TNotifyEvent read FOnChange write FOnChange;
       procedure Draw(X, Y: Integer; Graphic: TGraphic);
       procedure StretchDraw(const Rect: TRect; Graphic: TGraphic);
       property Pixels[X, Y: Integer]: TColor read GetPixel write SetPixel;
     end;

     TStrings=class(TComponent);

     TCursor=Integer;

     TFiler=class
     end;

     TCustomPanel=class(TComponent)
     protected
       procedure AssignTo(Dest: TPersistent); virtual;
       procedure CreateParams(var Params: TCreateParams); virtual;
       Procedure DefineProperties(Filer:TFiler); virtual; // obsolete
     public
       Constructor Create(AOwner: TComponent); virtual;
     end;

     TMouseButton=(mbLeft,mbMiddle,mbRight);
     TBorderStyle=(bsSingle);
     {$ENDIF}

     {$IFDEF CLX}

     // Fake class to support TUpDown in CLX
     // Inherits from CLX TSpinEdit control.

     TUDBtnType=(btNext, btPrev);
     TUDOrientation=(udHorizontal, udVertical);

     TUpDown=class(TSpinEdit)
     private
       FAssociate   : TComponent;
       FOrientation : TUDOrientation;
       FThousands   : Boolean;

       IChangingText : Boolean;
       OldChanged    : TNotifyEvent;
       Procedure DoChangeEdit;
       Procedure ChangedEdit(Sender:TObject);
       Procedure GetOldChanged;
       function GetPosition: Integer;
       procedure SetPosition(const AValue: Integer);
       procedure SetAssociate(const AValue: TComponent);
     protected
       procedure Change(AValue: Integer); override;
       Procedure Loaded; override;
     public
       Constructor Create(AOwner:TComponent); override;
     published
       property Associate:TComponent read FAssociate write SetAssociate;
       property Orientation: TUDOrientation read FOrientation write FOrientation default udVertical;
       property Position:Integer read GetPosition write SetPosition default 0;
       property Thousands: Boolean read FThousands write FThousands default True;
     end;
     {$ENDIF}

     TPenEndStyle=(esRound,esSquare,esFlat);

     TChartPen=class(TPen)
     private
       FEndStyle  : TPenEndStyle;
       FSmallDots : Boolean;
       FVisible   : Boolean;

       {$IFDEF CLR}
       [EditorBrowsable(EditorBrowsableState.Never)]
       {$ENDIF}
       Function IsEndStored:Boolean;

       {$IFDEF CLR}
       [EditorBrowsable(EditorBrowsableState.Never)]
       {$ENDIF}
       Function IsVisibleStored:Boolean;

       procedure SetEndStyle(const Value: TPenEndStyle);
       Procedure SetSmallDots(Value:Boolean);
       Procedure SetVisible(Value:Boolean);
     protected
       DefaultEnd : TPenEndStyle;
       DefaultVisible : Boolean;
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
       Procedure Assign(Source:TPersistent); override;
       procedure Hide;
       procedure Show;
     published
       property EndStyle:TPenEndStyle read FEndStyle write SetEndStyle stored IsEndStored;
       property SmallDots:Boolean read FSmallDots write SetSmallDots default False;
       property Visible:Boolean read FVisible write SetVisible stored IsVisibleStored;
     end;

     TChartHiddenPen=class(TChartPen)
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
     published
       property Visible default False;
     end;

     TDottedGrayPen=class(TChartPen)
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
     published
       property Color default clGray;
       property Style default psDot;
     end;

     TDarkGrayPen=class(TChartPen)
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
     published
       property Color default clDkGray;
     end;

     TWhitePen=class(TChartPen)
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
     published
       property Color default clWhite;
     end;

     TChartBrush=class(TBrush)
     private
       FImage : TPicture;
       Function GetImage:TPicture;
       procedure SetImage(Value:TPicture);
     public
       Constructor Create(OnChangeEvent:TNotifyEvent); {$IFDEF CLR}virtual;{$ENDIF}
       Destructor Destroy; override;

       Procedure Assign(Source:TPersistent); override;
       Procedure Clear;
     published
       property Color default clDefault;
       property Image:TPicture read GetImage write SetImage;
     end;

     TTeeView3DScrolled=procedure(IsHoriz:Boolean) of object;
     TTeeView3DChangedZoom=procedure(NewZoom:Integer) of object;

     TView3DOptions = class(TPersistent)

⌨️ 快捷键说明

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