Thema: Delphi Fehler bei Tasten-Druck

Einzelnen Beitrag anzeigen

Benutzerbild von Sharky
Sharky

Registriert seit: 29. Mai 2002
Ort: Frankfurt
8.252 Beiträge
 
Delphi 2006 Professional
 
#11

Re: Fehler bei Tasten-Druck

  Alt 2. Jan 2004, 11:13
Zitat von cylon:
Kann mir dann mal jemand sagen, was an dem Code falsch ist, den ich zum Download gestellt hab????
Hai cylon,

versuche es mal so:

Delphi-Quellcode:
procedure TFormZero.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if key = vk_down then
    begin
      Aktiv := Aktiv + 1;
      if (Aktiv = 6) then Aktiv := 1;
      case Aktiv of
          1: begin
                ImageNS.Picture.LoadFromFile('Graphiken\newgame_a.bmp');
                ImageB.Picture.LoadFromFile('Graphiken\beenden.bmp');
              end;
          2: begin
                ImageSL.Picture.LoadFromFile('Graphiken\loadgame_a.bmp');
                ImageNS.Picture.LoadFromFile('Graphiken\newgame.bmp');
              end;
          3: begin
                ImageO.Picture.LoadFromFile('Graphiken\options_a.bmp');
                ImageSL.Picture.LoadFromFile('Graphiken\loadgame.bmp');
              end;
          4: begin
                ImageC.Picture.LoadFromFile('Graphiken\credits_a.bmp');
                ImageO.Picture.LoadFromFile('Graphiken\options.bmp');
              end;
          5: begin
                ImageB.Picture.LoadFromFile('Graphiken\beenden_a.bmp');
                ImageC.Picture.LoadFromFile('Graphiken\credits.bmp');
              end;
      end;
    end;
 if key= vk_up then
    begin
      Aktiv := Aktiv - 1;
      if (Aktiv = 0) then Aktiv = 5;
      case Aktiv of
          1: begin
                ImageNS.Picture.LoadFromFile('Graphiken\newgame_a.bmp');
                ImageB.Picture.LoadFromFile('Graphiken\loadgame.bmp');
              end;
          2: begin
                ImageSL.Picture.LoadFromFile('Graphiken\loadgame_a.bmp');
                ImageNS.Picture.LoadFromFile('Graphiken\options.bmp');
              end;
          3: begin
                ImageO.Picture.LoadFromFile('Graphiken\options_a.bmp');
                ImageSL.Picture.LoadFromFile('Graphiken\credits.bmp');
              end;
          4: begin
                ImageO.Picture.LoadFromFile('Graphiken\credits_a.bmp');
                ImageC.Picture.LoadFromFile('Graphiken\beenden.bmp');
              end;
          5: begin
                ImageB.Picture.LoadFromFile('Graphiken\beenden_a.bmp');
                ImageC.Picture.LoadFromFile('Graphiken\newgame.bmp');
              end;
      end;
    end;
end;
Stephan B.
"Lasst den Gänsen ihre Füßchen"
  Mit Zitat antworten Zitat