Delphi 组件编写--扑克牌组件[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 hunto 的 blog

  bitblt(canvas.handle,0,0,width,height,  //画图
    cardmap.canvas.handle ,x,y,srccopy);
end;

procedure tcard.setfaceup(flag: bool);//设置牌面朝上还是朝下
begin
  ffaceup:=flag;
  paint;         //重画
end;

function tcard.getvalue: integer;
begin
  result:=cardid shr 2; //得到该牌的值
  inc(result);
end;

function tcard.getsuit:tcardsuit;
begin
  result:=tcardsuit(cardid and 3);  //得到该牌的花色
end;

initialization  //单元初始化
  cardmap:=tbitmap.create ; //创建位图
  cardmap.loadfromresourcename(hinstance,'card');//从资源中导入
finalization
  cardmap.free ;//清除位图
end.
   



  

本文关键:Delphi 组件编写--扑克牌组件
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top