unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Image1: TImage;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
meinstartX, meinstartY : integer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
image1.Canvas.Pen.color:=cl3DDkShadow;
image1.canvas.Brush.Color := clblack;
image1.Canvas.fillrect(rect(0,0,image1.width,image1.height));
image1.canvas.Brush.Color := cl3DDkShadow;
image1.Canvas.FillRect(rect(20,20,image1.Width-20,image1.Height-20));
image1.Canvas.Brush.Color := clwhite;
image1.Canvas.ellipse(meinstartX-10,meinStartY-10,meinStartX+10,meinStartY+10);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
image1.Canvas.Pen.color:=cl3DDkShadow;
image1.canvas.Brush.Color := cl3DDkShadow;
image1.Canvas.ellipse(meinstartX-10,meinStartY-10,meinStartX+10,meinStartY+10);
meinstartY := meinstartY +10;
image1.Canvas.Pen.color:=cl3DDkShadow;
image1.Canvas.Brush.Color := clwhite;
image1.Canvas.ellipse(meinstartX-10,meinStartY-10,meinStartX+10,meinStartY+10);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
meinstartX := image1.Width
div 2;
meinStartY := 100;
form1.KeyPreview := true;
end;
procedure TForm1.FormKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin
if key = vk_down
then
begin
image1.canvas.Brush.Color := cl3DDkShadow;
image1.Canvas.ellipse(meinstartX-10,meinStartY-10,meinStartX+10,meinStartY+10);
meinstartX := meinstartX +10;
meinstartY := meinstartY +10;
image1.Canvas.Pen.color:=clwhite;
image1.Canvas.Brush.Color := clwhite;
image1.Canvas.ellipse(meinstartX-10,meinStartY-10,meinStartX+10,meinStartY+10);
end;
end;
end.