Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#2

Re: TImage.Create() in extra Unit

  Alt 25. Mär 2007, 14:12
Hi,

Zitat:
als Parameter wird u.a. eine TForm für die parent-Eigenschaft übergeben
was heißt EINE TForm? Du musst die Form übergeben auf der das Image sein soll....
So ungefähr sollte das ganze aussehn:

Delphi-Quellcode:
// Andere Unit:
TKlasse = class
private
  FImage: TImage;
public
  constructor Create(AParent: TForm);
end;

constructor TKlasse.Create(AParent: TForm);
begin
  inherited Create;
  FImage := TImage.Create(AParent);
  with FImage do
  begin
    Parent := AParent;
    //...
  end;
end;

// Haupt-Unit:
var Test: TKlasse;
begin
  Test := TKlasse.Create(Form1);
end;
Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat