程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> 紙牌控件的編寫(下)

紙牌控件的編寫(下)

編輯:Delphi

constructor TZFPlayCard.Create(AOwner: TComponent);<?XML:namespace prefix = o ns = "urn:schemas-microsoft-com:office:Office" />

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.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved