在这个颜值当道,屌丝闪边的时代,拼不过颜值拼内涵,只有知识丰富才能提升一个人的内在气质和修养,所谓人丑就要多学习,今天图老师给大家分享纸牌控件的编写(中),希望可以对大家能有小小的帮助。
【 tulaoshi.com - 编程语言 】
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;
}
来源:http://www.tulaoshi.com/n/20160219/1601331.html