CSDN博客

img xzhifei

纸牌控件的编写(中)

发表于2004/5/17 17:48:00  1156人阅读

分类: VCL

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;

}

 

未完,请看下一章。

阅读全文
0 0

相关文章推荐

img
取 消
img