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

纸牌控件的编写(下)

 2006-02-04 13:47:11 来源:WEB开发网   
核心提示:constructor TZFPlayCard.Create(AOwner: TComponent);var x, y: integer;begin inherited Create(AOwner); FCardId := 1; cdtInit(x, y); SetBounds(0, 0, x, y); C

constructor TZFPlayCard.Create(AOwner: TComponent);

var

  x, y: integer;

begin

  inherited Create(AOwner);

  FCardId := 1;

  cdtInit(x, y);

  SetBounds(0, 0, x, y);

  ControlStyle := [csClickEvents, csDoubleClicks];

  Enabled := True;

  Canvas.Brush.Style := bsClear;

  FGlyph := TBitMap.Create;

end;

 

destructor TZFPlayCard.Destroy;

begin

  FGlyph.Free;

  inherited;

end;

PRocedure TZFPlayCard.Paint;

begin

  inherited;

  ReDraw;

end;

 

procedure TZFPlayCard.ReDraw;

begin

  cdtDraw(Canvas.Handle, 0, 0, FCardId, Ord(FCardMode), clWhite);

  if FGlyph <> nil then

  begin

   canvas.StretchDraw(RECT(12, 11, 59, 85), FGlyph);

  end;

end;

 

procedure TZFPlayCard.SetCardId(const Value: TCardId);

begin

  FCardId := Value;

  ReDraw;

end;

 

procedure TZFPlayCard.SetCardMode(const Value: TCardMode);

begin

  FCardMode := Value;

  ReDraw;

end;

 

procedure TZFPlayCard.SetGlyph(const Value: TBitMap);

begin

  if value <> FGlyph then

   begin

    FGlyph.Assign(value);

    Invalidate;

   end;

end;

 

procedure TZFPlayCard.WMEraseBkgnd(var Message: TWMEraseBkgnd);

begin

  Message.Result:=1;

end;

 

end.

Tags:纸牌 控件 编写

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