![]() |
FindComponent Problem ?
Hallo
das suchen nach einem Image innerhalb des Formulars funktioniert aber wenn ich nach einem Image außerhalb suche, dann erscheint diese Fehlermeldung : "undeclared TImage" !
Delphi-Quellcode:
ich habe natürlich das String "myimage" als Global Variable in Form2 deklariert :
image1.picture.Bitmap.Assign(Form2.TImage(FindComponent(Form2.myimage)).Picture.Bitmap);
Delphi-Quellcode:
Bublic
myimage: String; end; |
Re: FindComponent Problem ?
Entwder
Delphi-Quellcode:
oder besser
image1.picture.Bitmap.Assign(TImage(Form2.FindComponent(Form2.myimage)).Picture.Bitmap);
Delphi-Quellcode:
image1.picture.Bitmap.Assign((Form2.FindComponent(Form2.myimage) as TImage).Picture.Bitmap);
|
Re: FindComponent Problem ?
Es hat geklappt. Danke
Einige schreiben dafür eine Funktion :!: ![]() |
Re: FindComponent Problem ?
Zitat:
Delphi-Quellcode:
Noch schlauer wäre natürlich eine Funktion auf TForm2:
var
c : TComponent; begin if Assigned(Form2) then begin c := Form2.FindComponent(Form2.myimage); if Assigned(c) then image1.picture.Bitmap.Assign((c as TImage).Picture.Bitmap); end;
Delphi-Quellcode:
function TForm2.GetMyBitmap:TBitmap;
var c : TComponent; begin c := FindComponent(myimage); if Assigned(c) then result := (c as TImage).Picture.Bitmap else Result := nil; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:24 Uhr. |
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