1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46:
| type TBubbleStone = class (TPanel) protected fForm, fColor: string; fImage: TImage; fIndex, fPoints: Integer; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Initialize(BallID: integer); published property BallForm: string read fForm write fForm; property BallColor: string read fColor write fColor; property BallPoints: integer read fPoints write fPoints; property Index: integer read fIndex write fIndex; property Image: TImage read fImage write fImage; end; //--------------------------------------------------------------------
constructor TBubbleStone.Create; begin inherited Create(AOwner);
Height := 20; Width := 20;
fImage := TImage.Create(AOwner); fImage.Parent := Self; fImage.Align := alClient; end;
destructor TBubbleStone.Destroy; begin inherited; end;
procedure TBubbleStone.Initialize(BallID: integer); const Colors: array[0..4] of string = ('Blue','Red','Green','White','Orange'); Points: array[0..4] of integer = ( 80, 200, 150, 300, 500);
begin fImage.Picture.LoadFromFile('BITMAPS\Ball'+IntToStr(BallID)+'.bmp'); fColor := Colors[BallID]; fForm := 'Circle'; fPoints := Points[BallID]; end; |