unit GraphicControl1;
interface
uses
SysUtils, Classes, Controls,Graphics,Messages;
type
TMyButton =
class(TGraphicControl)
private
{ Private-Deklarationen }
ou,uo,lr,rl,Elo,Ero,Eru,Elu:TBitmap;
procedure WMPaint(
var Msg: TWMPaint);
message WM_Paint;
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
published
{ Published-Deklarationen }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Samples', [TMyButton]);
end;
constructor TMyButton.Create(AOwner: TComponent);
begin
ou := TBitmap.Create;
//Bitmaps anlegen und initilisieren
uo := TBitmap.Create;
lr := TBitmap.Create;
rl := TBitmap.Create;
Elo := TBitmap.Create;
Ero := TBitmap.Create;
Eru := TBitmap.Create;
Elu := TBitmap.Create;
ou.LoadFromFile('
ou.bmp');
uo.LoadFromFile('
uo.bmp');
lr.LoadFromFile('
lr.bmp');
rl.LoadFromFile('
rl.bmp');
Elo.LoadFromFile('
Elo.bmp');
Ero.LoadFromFile('
Ero.bmp');
Eru.LoadFromFile('
Eru.bmp');
Elu.LoadFromFile('
Elu.bmp');
end;
destructor TMyButton.Destroy;
begin
ou.Free;
//Speicher freigeben
uo.Free;
lr.Free;
rl.Free;
Ero.Free;
Elo.Free;
Eru.Free;
Elu.Free;
end;
procedure TMyButton.WMPaint(
var Msg: TWMPaint);
// message WM_Paint;
var
i:integer;
begin
//Canvas komplett überzeichnen
Self.canvas.brush.color := $E3DFE0;
//Ich glaube hier fängt es schon an mit den Fehlern
Self.canvas.brush.Style := bsSolid;
Self.canvas.fillrect(rect(0,0,Self.ClientWidth,Self.ClientHeight));
//Hier zeichnet es was
For i := 15
to Self.ClientWidth - 15
do begin
Self.Canvas.Draw(i,0,ou);
Self.Canvas.Draw(i,Self.ClientHeight-uo.Height,uo);
end;
For i := 15
to Self.ClientHeight -15
do begin
Self.Canvas.Draw(0,i,lr);
Self.Canvas.Draw(Self.ClientWidth-rl.Width,i,rl);
end;
end;
end.