(Co-Admin)
Registriert seit: 7. Jul 2003
Ort: Schwabenländle
14.929 Beiträge
Turbo Delphi für Win32
|
AW: Den Panel mit Pfeil-Tasten bewegen
19. Apr 2011, 22:17
Ich habe auch was gefunden:
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
private
{ Private-Deklarationen }
procedure CMDialogKey( var Msg: TWMKey); message CM_DIALOGKEY;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CMDialogKey( var Msg: TWMKEY);
var
handled: Boolean;
begin
handled := true;
case msg.charcode of
VK_UP: Panel1.Top := Panel1.Top - 10;
VK_DOWN: Panel1.Top := Panel1.Top + 10;
VK_LEFT: Panel1.Left := Panel1.Left - 10;
VK_RIGHT: Panel1.Left := Panel1.Left + 10;
else
handled := False
end;
if handled then
msg.result := 1
else
inherited;
end;
end.
|
|
Zitat
|