Delphi-PRAXiS
Seite 3 von 3     123   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Probleme mit Property einer Komponente (https://www.delphipraxis.net/34127-probleme-mit-property-einer-komponente.html)

Stevie 18. Nov 2004 10:56

Re: Probleme mit Property einer Komponente
 
Liste der Anhänge anzeigen (Anzahl: 1)
Indem du dir eine Ableitung von TIcon schreibst, die das kann...

Für die Methode LoadFromFile hab ich das mal gemacht.

Helmi 27. Dez 2004 10:24

Re: Probleme mit Property einer Komponente
 
Hallo,

Jetzt muss ich nochmal dieses Thema aufgreifen, da ich wieder mit TIcons rumspiele.

Ich hab mir mal das Icon-Laden vom TForm angeschaut und musste feststellen, dass beim LoadFromFile vom TIcon das neue Icon sofort angezeigt wird und nicht wie durch das Umladen eines Extra-Icons (siehe paar Thread weiter oben).

In der Forms.pas ist folgendes drin (ich hoffe dass darf man hier veröffentlichen):
Code:
protected
  property Icon: TIcon read FIcon write SetIcon stored IsIconStored;

procedure TCustomForm.OnCreate....
begin
FIcon.OnChange := IconChanged;
end;

procedure TCustomForm.SetIcon(Value: TIcon);
begin
  FIcon.Assign(Value);
end;

procedure TCustomForm.IconChanged(Sender: TObject);
begin
  if NewStyleControls then
  begin
    if HandleAllocated and (BorderStyle <> bsDialog) then
      SendMessage(Handle, WM_SETICON, 1, GetIconHandle);
  end else
    if IsIconic(Handle) then Invalidate;
end;
Ich habe jetzt gleiche jetzt mal in meiner Komponente drin, nur das IconChanged hab ich wie folgt geändert:
Code:
  SendMessage(IconData.hIcon, WM_SETICON, 1, FIcon.Handle);
Nur leider wird das Icon nicht geändert.
Was macht TForm was ich nicht mach? :?:

mfg
Helmi

Stevie 28. Dez 2004 08:53

Re: Probleme mit Property einer Komponente
 
Nun ja...
Delphi-Quellcode:
SendMessage(Handle, WM_SETICON, 1, GetIconHandle);
ist halt was anderes, als
Delphi-Quellcode:
SendMessage(IconData.hIcon, WM_SETICON, 1, FIcon.Handle);
Oben wird an das Fenster eine Nachricht geschickt (Handle ist dasselbe wie Self.Handle) und bei dir an das Icon-Handle!
Wenn, dann müsstest du an dein Componente die Nachricht schicken, allerdings müsste die dafür ein Hanlde besitzen, was imho erst in TWinControl implementiert ist.


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:46 Uhr.
Seite 3 von 3     123   

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