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