📄 part_3.txt
字号:
procedure TCustomTrayIcon.Refresh;
begin
if not (csDesigning in ComponentState) then
begin
FData.hIcon := FCurrentIcon.Handle;
if Visible then
Refresh(NIM_MODIFY);
end;
end;
function TCustomTrayIcon.Refresh(Message: Integer): Boolean;
begin
Result := Shell_NotifyIcon(Message, @FData);
end;
procedure TCustomTrayIcon.SetIconIndex(Value: Integer);
begin
if FIconIndex <> Value then
begin
FIconIndex := Value;
if not (csDesigning in ComponentState) then
begin
if Assigned(FIconList) then
FIconList.GetIcon(FIconIndex, FCurrentIcon);
Refresh;
end;
end;
end;
procedure TCustomTrayIcon.DoOnAnimate(Sender: TObject);
begin
if Assigned(FOnAnimate) then
FOnAnimate(Self);
if Assigned(FIconList) and (FIconIndex < FIconList.Count - 1) then
IconIndex := FIconIndex + 1
else
IconIndex := 0;
Refresh;
end;
procedure TCustomTrayIcon.SetIcon(Value: TIcon);
begin
FIcon.Assign(Value);
FCurrentIcon.Assign(Value);
Refresh;
end;
procedure TCustomTrayIcon.SetBalloonHint(const Value: string);
begin
if CompareStr(FBalloonHint, Value) <> 0 then
begin
FBalloonHint := Value;
StrPLCopy(FData.szInfo, FBalloonHint, SizeOf(FData.szInfo) - 1);
Refresh(NIM_MODIFY);
end;
end;
procedure TCustomTrayIcon.SetDefaultIcon;
begin
if not FIcon.Empty then
FCurrentIcon.Assign(FIcon)
else
FCurrentIcon.Assign(Application.Icon);
Refresh;
end;
procedure TCustomTrayIcon.SetBalloonTimeout(Value: Integer);
begin
FData.uTimeout := Value;
end;
function TCustomTrayIcon.GetBalloonTimeout: Integer;
begin
Result := FData.uTimeout;
end;
procedure TCustomTrayIcon.ShowBalloonHint;
begin
FData.uFlags := FData.uFlags or NIF_INFO;
FData.dwInfoFlags := Integer(FBalloonFlags);
Refresh(NIM_MODIFY);
end;
procedure TCustomTrayIcon.SetBalloonTitle(const Value: string);
begin
if CompareStr(FBalloonTitle, Value) <> 0 then
begin
FBalloonTitle := Value;
StrPLCopy(FData.szInfoTitle, FBalloonTitle, SizeOf(FData.szInfoTitle) - 1);
Refresh(NIM_MODIFY);
end;
end;
initialization
StartClassGroup(TControl);
GroupDescendentsWith(TTimer, Controls.TControl);
//TCustomTrayIcon.RM_TaskBarCreated := RegisterWindowMessage('TaskbarCreated');
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -