Einzelnen Beitrag anzeigen

Benutzerbild von CReber
CReber

Registriert seit: 26. Nov 2003
Ort: Berlin
343 Beiträge
 
Delphi 2006 Professional
 
#3

Re: TJvTrayIcon aktualisieren

  Alt 19. Mai 2005, 23:22
Hier noch ein Auszug aus dem Quellcode:

1. Schritt

Delphi-Quellcode:
procedure TJvTrayIcon.SetIconIndex(const Value: Integer);
begin
  if FIconIndex <> Value then begin
    FIconIndex := Value;
    IconPropertyChanged;
  end;
2. Schritt

Delphi-Quellcode:
procedure TJvTrayIcon.SetCurrentIcon(Value: TIcon);
begin
  FCurrentIcon.Assign(Value);
  FIconData.hIcon := FCurrentIcon.Handle;
  if tisTrayIconVisible in FState then
    // if FIconData.hIcon = 0 then
    // HideTrayIcon
    // else
    NotifyIcon(NIF_ICON, NIM_MODIFY);
end;
Delphi-Quellcode:
procedure TJvTrayIcon.IconPropertyChanged;
var
  Ico: TIcon;
begin
  if not (csLoading in ComponentState) then
  begin
    if (FIcons <> nil) and (FIconIndex >= 0) and (FIconIndex < FIcons.Count) then
    begin
      Ico := TIcon.Create;
      try
        FIcons.GetIcon(FIconIndex, Ico);
        SetCurrentIcon(Ico);
      finally
        Ico.Free;
      end;
    end
    else
    if Assigned(Icon) and (not Icon.Empty) then
      SetCurrentIcon(Icon)
    else
      SetCurrentIcon(Application.Icon);
  end;
end;

Vielleicht sieht das ja jemand raus, weil ich sehe es nicht
Christian Reber
  Mit Zitat antworten Zitat