WEB开发网
开发学院软件开发Delphi 纸牌控件的编写(中) 阅读

纸牌控件的编写(中)

 2006-02-04 13:47:15 来源:WEB开发网   
核心提示:function cdtInit(var CardWidth, CardHeight: TCoordinate): Bool; {$ifdefWin32}stdcall;{$ENDIF Win32}function cdtDraw(aDC: HDC; X, Y: TCoordinate; Card: TCardId;

function cdtInit(var CardWidth, CardHeight: TCoordinate): Bool; {$ifdef

Win32}stdcall;

{$ENDIF Win32}

function cdtDraw(aDC: HDC; X, Y: TCoordinate; Card: TCardId;

  Mode: Cardinal; Color: TColorRef): Bool;

{$IFDEF Win32}stdcall; {$endif

Win32}

function cdtDrawExt(aDC: HDC; X, Y, Width, Height: TCoordinate; Card: TCardId;

  Mode: Cardinal; Color: TColorRef): Bool;

{$IFDEF Win32}stdcall; {$endif

Win32}

PRocedure cdtTerm;

{$IFDEF Win32}stdcall;

{$ENDIF Win32}

function cdtAnimate(aDC: HDC; Card: TCardId; X, Y: TCoordinate;

  AnimateIndex: Word): Bool;

{$IFDEF Win32}stdcall;

{$ENDIF Win32}

type

  TZFPlayCard = class(TGraphicControl)

  private

   FCardId: TCardId;

   FDragging: Boolean;

   FDragMove: Boolean;

   FX, FY: Integer;

   FCardMode: TCardMode;

   FGlyph: TBitmap;

   procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;

   procedure ReDraw;

   procedure SetCardId(const Value: TCardId);

   procedure SetCardMode(const Value: TCardMode);

   procedure SetGlyph(const Value: TBitMap);

  protected

   procedure Paint; override;

  public

   constructor Create(AOwner: TComponent); override;

   destructor Destroy; override;

 

  published

   property CardMode: TCardMode read FCardMode write SetCardMode;

   property CardID: TCardId read FCardId write SetCardId default 1;

   property Glyph: TBitmap read FGlyph write SetGlyph;

   property Enabled;

   property Visible;

   property OnClick;

   property OnDblClick;

   property OnMouseDown;

   property OnMouseMove;

   property OnMouseUp;

  end;

 

procedure Register;

 

implementation

const

{$IFDEF win32}

  sCardsDLL = 'CARDS.DLL';

{$ELSE}

  sCardsDLL = 'CARDS';

{$ENDIF win32}

 

{$IFDEF win32}

function cdtInit; external sCardsDLL name 'cdtInit';

function cdtDraw; external sCardsDLL name 'cdtDraw';

function cdtDrawExt; external sCardsDLL name 'cdtDrawExt';

procedure cdtTerm; external sCardsDLL name 'cdtTerm';

function cdtAnimate; external sCardsDLL name 'cdtAnimate';

{$ELSE}

function cdtInit; external sCardsDLL index 1;

function cdtDraw; external sCardsDLL index 2;

function cdtDrawExt; external sCardsDLL index 3;

procedure cdtTerm; external sCardsDLL index 4;

function cdtAnimate; external sCardsDLL index 5;

{$ENDIF win32}

 

procedure Register;

begin

  RegisterComponents('Standard', [TZFPlayCard]);

end;

 

{ TZFPlayCard }

 

{procedure TZFPlayCard.Click;

begin

  inherited;

 

end;

}

 

未完,请看下一章。

Tags:纸牌 控件 编写

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接