Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi bild aus imagelist in Image (https://www.delphipraxis.net/92980-bild-aus-imagelist-image.html)

dajuhsa 13. Jun 2007 19:53

Re: bild aus imagelist in Image
 
ich hab schon wieder ein problem...

Delphi-Quellcode:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
var
BM: TBitmap;
begin
  if Key=#37 then begin
    BM := TBitmap.Create;
    try
      Imglist1.GetBitmap(1, BM);
      image1.Picture.Bitmap.Assign(BM);
    finally
      BM.Free;
    end;
  end;
  if Key=#38 then begin
    BM := TBitmap.Create;
    try
      Imglist1.GetBitmap(3, BM);
      image1.Picture.Bitmap.Assign(BM);
    finally
      BM.Free;
    end;
  end;
  if Key=#39 then begin
    BM := TBitmap.Create;
    try
      Imglist1.GetBitmap(2, BM);
      image1.Picture.Bitmap.Assign(BM);
    finally
      BM.Free;
    end;
  end;
  if Key=#40 then begin
    BM := TBitmap.Create;
    try
      Imglist1.GetBitmap(0, BM);
      image1.Picture.Bitmap.Assign(BM);
    finally
      BM.Free;
    end;
  end;
end;
funktioniert nicht, kein bild, keine reaktion... :wall:

Namenloser 13. Jun 2007 20:50

Re: bild aus imagelist in Image
 
Hi,

Zuerst einmal: Bist du sicher, dass das die richtigen Tastencodes sind? :zwinker:
Denn:
Code:
#37 = %
#38 = &
#39 = '
#40 = (
Evtl. hast du auch vergessen die Eigenschaft KeyPreview der Form auf true zu stellen.
Ansonsten sieht der Code nämlich richtig aus. :gruebel:

dajuhsa 13. Jun 2007 21:08

Re: bild aus imagelist in Image
 
ich hab mir mal ein programm geschrieben um mir die tastencodezahlen anzeigen zu lassen, da war alles richtig(a=65,b=66) und früher hat auch immer alles so geklappt, aber vllt. geht 37-40 nur bei KeyDown... , aber egal ich habs schön längst wieder hingekriegt :mrgreen:


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:23 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz