unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Shape1: TShape;
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case Key of
VK_LEFT: begin
shape1.Left := shape1.Left - 5;
Key := 0;
end;
VK_RIGHT: begin
shape1.Left := shape1.Left + 5;
Key := 0;
end;
VK_UP: begin
shape1.Top := shape1.Top - 5;
Key := 0;
end;
VK_DOWN: begin
shape1.Top := shape1.Top + 5;
Key := 0;
end;
end;
end;
end.