敬业的IT人 >> 编程开发 >> Delphi >> 纸牌控件的编写(中)

纸牌控件的编写(中)

敬业的IT人 互联网 佚名 2008-1-4 16:53:35

function cdtInit(var CardWidth, CardHeight: TCoordinate): Bool; {$ifdef<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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;

}

未完,请看下一章。

粤ICP备06119539号
Copyright CiscoSky.Org,Some Rights Reserved.
Email:me1228#tom.com