{"id":4114,"date":"2012-05-08T14:24:00","date_gmt":"2012-05-08T22:24:00","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=4114"},"modified":"2012-05-08T14:24:33","modified_gmt":"2012-05-08T22:24:33","slug":"spotlight-on-the-notifyicon-control","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2012\/05\/08\/spotlight-on-the-notifyicon-control\/","title":{"rendered":"Spotlight on the NotifyIcon Control"},"content":{"rendered":"<p><em>The \u201cSpotlight on Controls\u201d series focuses on a single WinForms control in PowerShell Studio 2012, details the important Properties, Methods, and Events of the control and demonstrates how to utilize the control. Most of the information about the controls is still applicable to previous versions of PrimalForms.<\/em><\/p>\n<p>Last time we took a look at the ListView control. This time we will look at the NotifyIcon control:<\/p>\n<p><span style=\"font-size: medium\"><strong>NotifyIcon <\/strong>[System.Windows.Forms.NotifyIcon]<\/span><\/p>\n<p>Specifies a component that creates an icon in the notification area of the Window\u2019s taskbar. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"NotifyIcon\" border=\"0\" alt=\"NotifyIcon\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/NotifyIcon.png\" width=\"134\" height=\"22\"><\/p>\n<p>Default Event: MouseDoubleClick<\/p>\n<p><em>Why use a NotifyIcon control?<\/em><\/p>\n<p>Use the NotifyIcon control, to alert users of special events, such as when a task is completed. Typically this control is used for informational purposes, but it can also be used as a source for user interaction.<\/p>\n<p>Note: When you add a NotifyIcon it will appear at the bottom of the Designer:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/NotifyIcon-in-Designer.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"NotifyIcon in Designer\" border=\"0\" alt=\"NotifyIcon in Designer\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/NotifyIcon-in-Designer_thumb.png\" width=\"244\" height=\"152\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong><font size=\"3\">Important Properties:<\/font><\/strong><\/p>\n<p><strong>BalloonTipText<\/strong><\/p>\n<p>This property sets the text associated with the balloon ToolTip. Use this property to display a message in the Balloon Tooltip.<\/p>\n<p>Setting the BalloonTipText in the script editor:<\/p>\n<pre><span style=\"color: #8b0000\">$NotifyIcon<\/span><span style=\"color: #000000\">.BalloonTipText <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #ff0000\">\"This is the balloon text\"<\/span><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"BalloonText\" border=\"0\" alt=\"BalloonText\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/BalloonText.png\" width=\"153\" height=\"64\"><\/p>\n<p><strong>BalloonTipTitle<\/strong><\/p>\n<p>This property sets the title of the balloon ToolTip.<br \/>The title text is displayed above the balloon text.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Balloon Title\" border=\"0\" alt=\"Balloon Title\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Balloon-Title.png\" width=\"152\" height=\"92\"><\/p>\n<p><strong>BalloonTipIcon<\/strong><\/p>\n<p>This property sets the icon to associate with the balloon Tooltip. In other words, the icon displayed inside the tooltip itself. <br \/>Note: The <em>BalloonTipTitle<\/em> property must be set in order to view the balloon icon.<\/p>\n<p>Values (Default: <em>None<\/em>):<\/p>\n<blockquote>\n<p><em>None<br \/><\/em>No icon is displayed.<br \/><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Icon None\" border=\"0\" alt=\"Icon None\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Icon-None.png\" width=\"147\" height=\"96\"><\/p>\n<p><em>Info<\/em><br \/>An information icon.<br \/><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Icon Info\" border=\"0\" alt=\"Icon Info\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Icon-Info.png\" width=\"153\" height=\"95\"><\/p>\n<p><em>Warning<\/em><br \/>A warning icon.<br \/><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Icon Warning\" border=\"0\" alt=\"Icon Warning\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Icon-Warning.png\" width=\"186\" height=\"95\"><\/p>\n<p><em>Error<\/em><br \/>An error icon.<br \/><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Icon Error\" border=\"0\" alt=\"Icon Error\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Icon-Error.png\" width=\"164\" height=\"95\"><\/p>\n<\/blockquote>\n<p><strong>Icon<\/strong><\/p>\n<p>This property sets the icon to display in the system tray. <\/p>\n<p><font color=\"#ff0000\">Important: This property must be set; otherwise the tooltip balloon will not show!<\/font><\/p>\n<p>The designer will allow you to browse and select an icon to display when the tooltip is shown.<\/p>\n<p>Click on the browse button in the Property Panel:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Icon-Property-in-the-PropertyPanel.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Icon Property in the PropertyPanel\" border=\"0\" alt=\"Icon Property in the PropertyPanel\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Icon-Property-in-the-PropertyPanel_thumb.png\" width=\"244\" height=\"84\"><\/a><\/p>\n<p>Or use the menu in the designer:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Choose Icon Designer\" border=\"0\" alt=\"Choose Icon Designer\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Choose-Icon-Designer.png\" width=\"263\" height=\"84\"><\/p>\n<p>Next select the Icon file<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Open-Icon-File-Dialog.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Open Icon File Dialog\" border=\"0\" alt=\"Open Icon File Dialog\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Open-Icon-File-Dialog_thumb.png\" width=\"244\" height=\"164\"><\/a><\/p>\n<p>Finally the Icon will be displayed in the system tray:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Icon in System Tray\" border=\"0\" alt=\"Icon in System Tray\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/Icon-in-System-Tray.png\" width=\"146\" height=\"34\"><\/p>\n<p>Note: If a \u201cphantom\u201d icon remains in the system tray after closing the form, then it is recommended set the Visible property to <em>False<\/em> in order to clear the icon before closing form.<\/p>\n<p><strong>ContextMenuStrip<\/strong><\/p>\n<p>This property sets the shortcut menu to show when the user right-clicks the icon. <br \/>Set this property to an existing ContextMenuStrip in order to assign a menu to the system tray icon. See <a href=\"http:\/\/www.sapien.com\/blog\/2011\/12\/16\/primalforms-2011-spotlight-on-the-contextmenustrip-control\/\">Spotlight on the ContextMenuStrip Control<\/a> for more details.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"NotifyIcon's ContextMenuStrip\" border=\"0\" alt=\"NotifyIcon's ContextMenuStrip\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/NotifyIcons-ContextMenuStrip.png\" width=\"190\" height=\"38\"><\/p>\n<p><strong>Visible<\/strong><\/p>\n<p>This property indicates whether the icon is visible in the notification area of the taskbar.<\/p>\n<p>Values (Default: <em>True<\/em>):<\/p>\n<blockquote>\n<p><em>True \/ False<\/em><\/p>\n<\/blockquote>\n<p><strong><font size=\"3\">Important Events:<\/font><\/strong><\/p>\n<p><strong>BalloonTipClicked<\/strong><\/p>\n<p>This event occurs when the balloon tip is clicked. Use this event to react to user clicks in the ToolTip balloon.<\/p>\n<pre><span style=\"color: #8b0000\">$notifyicon1_BalloonTipClicked<\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\">{\n    <\/span><span style=\"color: #0000ff; font-weight: bold\">Write-Host<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #ff0000\">'The Balloon Tip was Clicked'<\/span><span style=\"color: #000000\">\n}<\/span><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"BalloonTip Click\" border=\"0\" alt=\"BalloonTip Click\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/04\/BalloonTip-Click.png\" width=\"180\" height=\"94\"><\/strong><\/p>\n<p><strong><\/strong>&nbsp;<\/p>\n<p><strong>Clicked <\/strong><strong>&amp; DoubleClicked<\/strong><\/p>\n<p>These events occur when the system tray icon is clicked. If you need more information such as which mouse button was used, then it is recommended to use the MouseClick events (See below).<\/p>\n<p><strong>MouseClick<\/strong><\/p>\n<p>This event occurs when a user clicks on the system tray icon.<\/p>\n<p><strong>[System.Windows.Forms.LabelEditEventHandler]<\/strong><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"452\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"80\"><strong>Properties<\/strong><\/td>\n<td valign=\"top\" width=\"370\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"80\">Button<\/td>\n<td valign=\"top\" width=\"370\">Gets which mouse button was pressed.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"80\">Clicks<\/td>\n<td valign=\"top\" width=\"370\">Gets the number of times the mouse button was pressed and released.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"80\">Delta<\/td>\n<td valign=\"top\" width=\"370\">(Not applicable)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"80\">Location<\/td>\n<td valign=\"top\" width=\"370\">Gets the location of the mouse during the generating mouse event.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"80\">X<\/td>\n<td valign=\"top\" width=\"370\">Gets the x-coordinate of the mouse during the generating mouse event.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"80\">Y<\/td>\n<td valign=\"top\" width=\"370\">Gets the y-coordinate of the mouse during the generating mouse event.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><pre><span style=\"color: #8b0000\">$notifyicon1_MouseClick<\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\">[System.Windows.Forms.MouseEventHandler]{\n<\/span><span style=\"color: #008000\">#Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]<\/span><span style=\"color: #000000\">\n    <\/span><span style=\"color: #0000ff; font-weight: bold\">Write-Host<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #ff0000\">\"System Tray Icon Mouse Click: $($_.Button) Clicks: $($_.Clicks)\"<\/span><span style=\"color: #000000\">\n}<\/span><\/pre>\n<p><strong>MouseDoubleClick<\/strong> <\/p>\n<p>These events occur when a user double clicks on a system tray icon. This event has the same arguments as the MouseClick event.<\/p>\n<pre><span style=\"color: #8b0000\">$notifyicon1_MouseDoubleClick<\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\">[System.Windows.Forms.MouseEventHandler]{\n<\/span><span style=\"color: #008000\">#Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]<\/span><span style=\"color: #000000\">\n    <\/span><span style=\"color: #0000ff; font-weight: bold\">Write-Host<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #ff0000\">\"System Tray Icon Mouse Double Click: $($_.Button) Clicks: $($_.Clicks)\"<\/span><span style=\"color: #000000\">\n}<\/span><\/pre>\n<p><strong><font size=\"3\">Important Methods:<\/font><\/strong><\/p>\n<p><strong>ShowBalloonTip<\/strong><\/p>\n<p>This method displays a balloon tip in the taskbar for the specified time period.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: x-small\"><font size=\"2\"><span style=\"color: #0000ff\">[void]<\/span> <span style=\"color: #4bacc6\">ShowBalloonTip<\/span>(<span style=\"color: #0000ff\">[<\/span><span style=\"color: #0000ff\">int] <\/span><span style=\"color: #333333\">timeout<\/span>)<\/font><\/span><\/p>\n<p>Note: The method uses the properties of the NotifyIcon to display the balloon tip. Therefore they must be set before calling this method.<span style=\"font-size: x-small\"><font size=\"2\"><\/p>\n<p><\/font><\/span><\/p>\n<pre><span style=\"color: #8b0000\">$NotifyIcon<\/span><span style=\"color: #000000\">.ShowBalloonTip(<\/span><span style=\"color: #000000\">0<\/span><span style=\"color: #000000\">)<\/span><\/pre>\n<pre><span style=\"color: #000000\"><\/span>&nbsp;<\/pre>\n<p><span style=\"font-size: x-small\"><font size=\"2\"><span style=\"color: #0000ff\">[void]<\/span> <span style=\"color: #4bacc6\">ShowBalloonTip<\/span>(<span style=\"color: #0000ff\">[<\/span><span style=\"color: #0000ff\">int] <\/span><span style=\"color: #333333\">timeout, <span style=\"color: #0000ff\">[<\/span><span style=\"color: #0000ff\">string] <\/span><span style=\"color: #333333\">tipTitle, <span style=\"color: #0000ff\">[<\/span><span style=\"color: #0000ff\"><span style=\"color: #0000ff\">string<\/span>] <\/span><span style=\"color: #333333\">tipText, <span style=\"color: #0000ff\">[<\/span><span style=\"color: #0000ff\">ToolTipIcon] <\/span>tipIcon<\/span><\/span><\/span>)<\/font><\/span><\/p>\n<p>Note: This variation, displays a balloon tip with the specified title, text, and icon in the taskbar for the specified time period. You need not set the NotifyIcon\u2019s properties if you use this method variation.<\/p>\n<pre><span style=\"color: #8b0000\">$NotifyIcon<\/span><span style=\"color: #000000\">.ShowBalloonTip(<\/span><span style=\"color: #8b0000\">$Timeout<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #8b0000\">$BalloonTipTitle<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #8b0000\">$BalloonTipText<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #8b0000\">$BalloonTipIcon<\/span><span style=\"color: #000000\">)<\/span><\/pre>\n<p><strong><font size=\"3\"><\/font><\/strong>&nbsp;<\/p>\n<p><strong><font size=\"3\">Helper Function:<\/font><\/strong><\/p>\n<p>The following is a helper function that allows you to display the NotifyIcon. The help function also assigns the calling executable\u2019s icon, if the NotifyIcon\u2019s Icon property hasn\u2019t been assigned.<\/p>\n<pre><span style=\"color: #0000ff\">function<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #008080\">Show-NotifyIcon<\/span><span style=\"color: #000000\">\n{\n<\/span><span style=\"color: #008000\">&lt;#\n    .SYNOPSIS\n        Displays a NotifyIcon's balloon tip message in the taskbar's notification area.\n    \n    .DESCRIPTION\n        Displays a NotifyIcon's a balloon tip message in the taskbar's notification area.\n        \n    .PARAMETER NotifyIcon\n         The NotifyIcon control that will be displayed.\n    \n    .PARAMETER BalloonTipText\n         Sets the text to display in the balloon tip.\n    \n    .PARAMETER BalloonTipTitle\n        Sets the Title to display in the balloon tip.\n    \n    .PARAMETER BalloonTipIcon    \n        The icon to display in the ballon tip.\n    \n    .PARAMETER Timeout    \n        The time the ToolTip Balloon will remain visible in milliseconds. \n        Default: 0 - Uses windows default.\n#&gt;<\/span><span style=\"color: #000000\">\n     <\/span><span style=\"color: #0000ff\">param<\/span><span style=\"color: #000000\">(\n      [Parameter(Mandatory <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #8b0000\">$true<\/span><span style=\"color: #000000\">, Position <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">0<\/span><span style=\"color: #000000\">)]\n      [ValidateNotNull()]\n      [System.Windows.Forms.NotifyIcon]<\/span><span style=\"color: #8b0000\">$NotifyIcon<\/span><span style=\"color: #000000\">,\n      [Parameter(Mandatory <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #8b0000\">$true<\/span><span style=\"color: #000000\">, Position <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">1<\/span><span style=\"color: #000000\">)]\n      [ValidateNotNullOrEmpty()]\n      [String]<\/span><span style=\"color: #8b0000\">$BalloonTipText<\/span><span style=\"color: #000000\">,\n      [Parameter(Position <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">2<\/span><span style=\"color: #000000\">)]\n      [String]<\/span><span style=\"color: #8b0000\">$BalloonTipTitle<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #ff0000\">''<\/span><span style=\"color: #000000\">,\n      [Parameter(Position <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">3<\/span><span style=\"color: #000000\">)]\n      [System.Windows.Forms.ToolTipIcon]<\/span><span style=\"color: #8b0000\">$BalloonTipIcon<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #ff0000\">'None'<\/span><span style=\"color: #000000\">,\n      [Parameter(Position <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">4<\/span><span style=\"color: #000000\">)]\n      [int]<\/span><span style=\"color: #8b0000\">$Timeout<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">0<\/span><span style=\"color: #000000\">\n     )\n    \n    <\/span><span style=\"color: #0000ff\">if<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #8b0000\">$NotifyIcon<\/span><span style=\"color: #000000\">.Icon <\/span><span style=\"color: #0000ff\">-eq<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #8b0000\">$null<\/span><span style=\"color: #000000\">)\n    {\n        <\/span><span style=\"color: #008000\">#Set a Default Icon otherwise the balloon will not show<\/span><span style=\"color: #000000\">\n        <\/span><span style=\"color: #8b0000\">$NotifyIcon<\/span><span style=\"color: #000000\">.Icon <\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\"> [System.Drawing.Icon]<\/span><span style=\"color: #0000ff\">::<\/span><span style=\"color: #000000\">ExtractAssociatedIcon([System.Windows.Forms.Application]<\/span><span style=\"color: #0000ff\">::<\/span><span style=\"color: #000000\">ExecutablePath)\n    }\n    \n    <\/span><span style=\"color: #8b0000\">$NotifyIcon<\/span><span style=\"color: #000000\">.ShowBalloonTip(<\/span><span style=\"color: #8b0000\">$Timeout<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #8b0000\">$BalloonTipTitle<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #8b0000\">$BalloonTipText<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #8b0000\">$BalloonTipIcon<\/span><span style=\"color: #000000\">)\n}<\/span><\/pre>\n<p>Example Use:<\/p>\n<pre><span style=\"color: #008080\">Show-NotifyIcon<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #3399ff\">-NotifyIcon<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #8b0000\">$notifyicon1<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #3399ff\">-BalloonTipText<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #8b0000\">$textboxText<\/span><span style=\"color: #000000\">.Text `<\/span><span style=\"color: #000000\">\n<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #3399ff\">-BalloonTipTitle<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #8b0000\">$textboxTitle<\/span><span style=\"color: #000000\">.Text <span style=\"color: #3399ff\">-BalloonTipIcon<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #8b0000\">$combobox1<\/span><span style=\"color: #000000\">.SelectedItem<\/span><\/span><\/pre>\n<p>&nbsp;<\/p>\n<p>You can download the <a href=\"http:\/\/www.sapien.com\/downloads#Sample Scripts\/PrimalForms 2011\/NotifyIconSample.zip\">NotifyIcon Sample<\/a> from our <a href=\"http:\/\/www.sapien.com\/downloads\">Downloads<\/a> section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The \u201cSpotlight on Controls\u201d series focuses on a single WinForms control in PowerShell Studio 2012, details the important Properties, Methods, and Events of the control and demonstrates how to utilize the control. Most of the information about the controls is still applicable to previous versions of PrimalForms. Last time we took a look at the [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[705,509,575,644,25],"tags":[641,704,28,633,327],"class_list":["post-4114","post","type-post","status-publish","format-standard","hentry","category-powershell-studio-2012","category-primalforms-software-news","category-primalforms-2011-software-news","category-spotlight-on-controls","category-windows-powershell","tag-controls","tag-notifyicon","tag-powershell","tag-primalforms-2011","tag-winform"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/4114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=4114"}],"version-history":[{"count":7,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/4114\/revisions"}],"predecessor-version":[{"id":4272,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/4114\/revisions\/4272"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=4114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=4114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=4114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}