📄 cooltrayicon.html
字号:
<td class='default' valign='top'>Returns true or false</td>
</tr>
<tr>
<td class='name' valign='top'>ShowBalloonHint</td>
<td class='desc' valign='top'><span class='declaration'>type TBalloonHintIcon = (bitNone, bitInfo, bitWarning, bitError, bitCustom);<br>
type TBalloonHintTimeOut = 10..60;<br>
function ShowBalloonHint(Title: String; Text: String; IconType: TBalloonHintIcon; TimeoutSecs: TBalloonHintTimeOut): Boolean;</span><br>
Shows a balloon hint (a kind of "sticky" popup hint).
You can use up to 64 chars for the title and up to 255 chars for the text.
The hint is visible for 10-60 seconds, or until the user clicks it (or until you
programmatically hide it). You cannot show a balloon hint if the tray icon is not showing,
and hiding the tray icon hides any balloon hint.<br>
<b>NOTE:</b> Balloon hints are not available in Win95 and Win98. Calling this method
in those Windows versions has no effect.<br>
<b>NOTE:</b> From WinXP SP 2 the balloon hint supports a custom icon, which is the
tray icon itself (the Icon property). To do this, set IconType to bitCustom.
If you want the balloon hint to show a custom icon which is not the same as Icon,
you must change Icon before calling ShowBalloonHint, then change Icon back again.<br>
<b>NOTE:</b> The HideBalloonHint method is automatically called by ShowBalloonHint,
so you don't get multiple balloon hints.<br>
<b>NOTE:</b> There appears to be a bug with the timeout value in WinXP.
See <a href='#XPBalloonTimeoutBug'>bugs section</a>.</td>
<td class='default' valign='top'>Returns true or false</td>
</tr>
<tr>
<td class='name' valign='top'>HideBalloonHint</td>
<td class='desc' valign='top'><span class='declaration'>function HideBalloonHint: Boolean;</span><br>
Hides the balloon hint (if any).</td>
<td class='default' valign='top'>Returns true or false</td>
</tr>
<tr>
<td class='name' valign='top'>Popup</td>
<td class='desc' valign='top'><span class='declaration'>procedure Popup(X, Y: Integer);</span><br>
Shows the associated popupmenu (if any) at the specified screen coordinates.</td>
<td class='default' valign='top'><br></td>
</tr>
<tr>
<td class='name' valign='top'>PopupAtCursor</td>
<td class='desc' valign='top'><span class='declaration'>procedure PopupAtCursor;</span><br>
Shows the associated popupmenu (if any) at the current cursor coordinates.
This method is usually called automatically in response to an OnClick event, but you can
call it manually if you want the popupmenu to appear at other times.</td>
<td class='default' valign='top'><br></td>
</tr>
<tr>
<td class='name' valign='top'>BitmapToIcon</td>
<td class='desc' valign='top'><span class='declaration'>function BitmapToIcon(const Bitmap: TBitmap; const Icon: TIcon; MaskColor: TColor): Boolean;</span><br>
Renders and returns an existing icon based on the specified bitmap.
The bitmap should be 16x16 pixels. Specify a color to be shown transparently or clNone
for no transparency.<br>
<b>NOTE:</b> Bitmaps that are not exactly 16x16 will be scaled up or down.</td>
<td class='default' valign='top'>Returns true or false</td>
</tr>
<tr>
<td class='name' valign='top'>GetTooltipHandle</td>
<td class='desc' valign='top'><span class='declaration'>function GetTooltipHandle: HWND;</span><br>
All tray icons share the same tooltip window (the hint popup).
This method returns the tooltip handle.</td>
<td class='default' valign='top'>Returns handle or 0 if error</td>
</tr>
<tr>
<td class='name' valign='top'>GetBalloonHintHandle</td>
<td class='desc' valign='top'><span class='declaration'>function GetBalloonHintHandle: HWND;</span><br>
All applications share the same balloon hint (if supported by the Windows version).
This method returns the balloon hint handle.</td>
<td class='default' valign='top'>Returns handle or 0 if error</td>
</tr>
<tr>
<td class='name' valign='top'>GetClientIconPos</td>
<td class='desc' valign='top'><span class='declaration'>function GetClientIconPos(X, Y: Integer): TPoint;</span><br>
Returns the cursor position <i>inside</i> the tray icon.
Will return coordinates between (-1,-1) and (16,16).
You would expect the coordinates to vary between 0 and 15, but Windows adds a border
1 pixel wide to all tray icons, which is appparently considered to be part of the tray icons.
Depending on whether the tray icon has other tray icons as neighbours to the left, right,
top, or bottom, the border is inserted as Windows sees fit.
So in other words, <i>this method is not exact</i>. You should expect a variation of 2 pixels.
If anyone sees a way to patch this, let me know.</td>
<td class='default' valign='top'>Returns position in a TPoint</td>
</tr>
<tr>
<td class='name' valign='top'>SetFocus</td>
<td class='desc' valign='top'><span class='declaration'>function SetFocus: Boolean;</span><br>
Sets focus to the tray icon (if it is visible).<br>
<b>NOTE:</b> Supported from ver. 5.0 of Internet Explorer.</td>
<td class='default' valign='top'>Returns true or false</td>
</tr>
<tr>
<td class='name2' valign='top'>ShowMainForm</td>
<td class='desc' valign='top'><i>This method applies only when the owner of the
tray icon component is a form.</i><br>
<span class='declaration'>procedure ShowMainForm;</span><br>
Shows the main form.<br>
<b>NOTE:</b> It is important that you use this method when displaying the form,
as it contains important calls that affect how the form and the application display
themselves. See the demo app.</td>
<td class='default' valign='top'><br></td>
</tr>
<tr>
<td class='name2' valign='top'>HideMainForm</td>
<td class='desc' valign='top'><i>This method applies only when the owner of the
tray icon component is a form.</i><br>
<span class='declaration'>procedure HideMainForm;</span><br>
Hides the main form.</td>
<td class='default' valign='top'><br></td>
</tr>
<tr>
<td class='name2' valign='top'>ShowTaskbarIcon</td>
<td class='desc' valign='top'><i>This method applies only when the owner of the
tray icon component is a form.</i><br>
<span class='declaration'>procedure ShowTaskbarIcon;</span><br>
Shows the application's taskbar icon (not to be confused with the tray icon).<br>
<td class='default' valign='top'><br></td>
</tr>
<tr>
<td class='name2' valign='top'>HideTaskbarIcon</td>
<td class='desc' valign='top'><i>This method applies only when the owner of the
tray icon component is a form.</i><br>
<span class='declaration'>procedure HideTaskbarIcon;</span><br>
Hides the application's taskbar icon (not to be confused with the tray icon).<br>
<b>NOTE:</b> If you display a child form the taskbar icon will become visible again
automatically. This is standard Windows behavior.</td>
<td class='default' valign='top'><br></td>
</tr>
</table>
<a name='Events'></a><h2>Events</h2>
<table cellpadding='2' cellspacing='2' border='0' width='100%'>
<tr>
<td class='name' valign='top'>OnClick</td>
<td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
Works like the similar event for window controls.<br>
<b>NOTE:</b> The Click event corresponds to a MouseDown followed by a MouseUp.
If no DblClick event is assigned the Click event fires immediately (ie. after
the MouseUp). Otherwise it will wait for a small period of time to see if the
user clicks again, in which case we have a double click. If no DblClick event
is assigned a double click will actually cause the Click event to fire.
This is intentional.</td>
</tr>
<tr>
<td class='name' valign='top'>OnDblClick</td>
<td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
Works like the similar event for window controls.</td>
</tr>
<tr>
<td class='name' valign='top'>OnMouseDown</td>
<td class='desc' valign='top'><span class='declaration'>TMouseEvent;</span><br>
Works like the similar event for window controls.</td>
</tr>
<tr>
<td class='name' valign='top'>OnMouseUp</td>
<td class='desc' valign='top'><span class='declaration'>TMouseEvent;</span><br>
Works like the similar event for window controls.</td>
</tr>
<tr>
<td class='name' valign='top'>OnMouseMove</td>
<td class='desc' valign='top'><span class='declaration'>TMouseMoveEvent;</span><br>
Works like the similar event for window controls.</td>
</tr>
<tr>
<td class='name' valign='top'>OnMouseEnter</td>
<td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
Fired after the cursor enters the tray icon. Requires
the WantEnterExitEvents property to be true.</td>
</tr>
<tr>
<td class='name' valign='top'>OnMouseExit</td>
<td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
Fired after the cursor leaves the tray icon. Requires
the WantEnterExitEvents property to be true.</td>
</tr>
<tr>
<td class='name' valign='top'>OnCycle</td>
<td class='desc' valign='top'><span class='declaration'>procedure(Sender: TObject; NextIndex: Integer) of object;</span><br>
Fired just before the icon changes via CycleIcons.
Returns the next index in the assigned imagelist.</td>
</tr>
<tr>
<td class='name' valign='top'>OnBalloonHintShow</td>
<td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
Fired after the balloon hint shows itself. This doesn't have to occur immediately
after you call the ShowBalloonHint method. In case another application is already
showing a balloon hint, your application must wait for it to close before it gets
to show the balloon hint itself. This event will tell you when it has shown the hint.<br>
<b>NOTE:</b> Not supported in Win2000. See <a href='#2000BalloonEventsBug'>bugs section</a>.
</td>
</tr>
<tr>
<td class='name' valign='top'>OnBalloonHintHide</td>
<td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
Fired after the balloon hint closes because another application needs to show a
balloon hint, or because you called either the ShowBalloonHint or the
HideBalloonHint method.<br>
<b>NOTE:</b> Not supported in Win2000.</td>
</tr>
<tr>
<td class='name' valign='top'>OnBalloonHintTimeout</td>
<td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
Fired after the balloon hint closes because it timed out.<br>
<b>NOTE:</b> Not supported in Win2000.</td>
</tr>
<tr>
<td class='name' valign='top'>OnBalloonHintClick</td>
<td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
Fired when the user clicks the balloon hint.<br>
<b>NOTE:</b> Not supported in Win2000.</td>
</tr>
<tr>
<td class='name2' valign='top'>OnMinimizeToTray</td>
<td class='desc' valign='top'><i>This event applies only when the owner of the
tray icon component is a form.</i><br>
<span class='declaration'>TNotifyEvent;</span><br>
Fired when the application is about to minimize to tray. Useful if you want to do special
processing, like animation effects, when the app. gets minimized (hidden).<br>
<b>NOTE:</b> MinimizeToTray must be true for this event to fire.</td>
</tr>
<tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -