<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: TrayItem Icon disappears in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3029230#M72634</link>
    <description>&lt;P&gt;I could recreate the same problem when an icon created using Visual studio is used.&lt;/P&gt;&lt;P&gt;Try creating an icon which similar to acad.ico (256 x 256, 32 bit).&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2011 05:12:21 GMT</pubDate>
    <dc:creator>Balaji_Ram</dc:creator>
    <dc:date>2011-05-19T05:12:21Z</dc:date>
    <item>
      <title>TrayItem Icon disappears</title>
      <link>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/2386483#M72631</link>
      <description>Hi all&lt;BR /&gt;
&lt;BR /&gt;
Can someone help me with custom trayitem/pane icon. I have the following code which is supposed to load a custom icon. The problem i am having is that the icon seems to disappear in Autocad.&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Public Class Class1&lt;BR /&gt;
Implements Autodesk.AutoCAD.Runtime.IExtensionApplication&lt;BR /&gt;
Overridable Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize &lt;BR /&gt;
AddTrayItems()&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Function GetEmbeddedIcon(ByVal strName As String) As Drawing.Icon&lt;BR /&gt;
Return New Drawing.Icon(System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(strName))&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Sub AddTrayItems()&lt;BR /&gt;
Try&lt;BR /&gt;
Dim doc As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
Dim ti As New TrayItem()&lt;BR /&gt;
ti.ToolTipText = "MyCadAddon Info"&lt;BR /&gt;
ti.Icon = GetEmbeddedIcon("MyCadAddon.blue.ico")&lt;BR /&gt;
Application.StatusBar.TrayItems.Add(ti)&lt;BR /&gt;
Dim bw As New TrayItemBubbleWindow()&lt;BR /&gt;
bw.Title = "MyCadAddon Application:"&lt;BR /&gt;
'bw.HyperText = ""&lt;BR /&gt;
' bw.HyperLink = ""&lt;BR /&gt;
bw.Text = "This application has been loaded sucessfully"&lt;BR /&gt;
bw.IconType = IconType.Information&lt;BR /&gt;
ti.ShowBubbleWindow(bw)&lt;BR /&gt;
Catch&lt;BR /&gt;
&lt;BR /&gt;
End Try&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Overridable Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
End Class&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
see also attached icon</description>
      <pubDate>Mon, 24 Nov 2008 13:13:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/2386483#M72631</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-24T13:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: TrayItem Icon disappears</title>
      <link>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3027796#M72632</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i'm in the same situation. I tried to load a custom icon as TrayItem, however sometimes I can see it but mostly there is only the space without the icon. Icons grabbed from an existing acad trayitem were always shown.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have&amp;nbsp;you found any solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Thosti&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2011 10:04:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3027796#M72632</guid>
      <dc:creator>Thosti</dc:creator>
      <dc:date>2011-05-18T10:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: TrayItem Icon disappears</title>
      <link>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3027828#M72633</link>
      <description>&lt;P&gt;Try reloading it on Document events.&amp;nbsp; It work most of the time for me.&amp;nbsp; Once and awhile I notice it gone.&amp;nbsp; But, not as much since I added on the Document Created event and Active Event.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2011 10:42:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3027828#M72633</guid>
      <dc:creator>michael_vanhoose</dc:creator>
      <dc:date>2011-05-18T10:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: TrayItem Icon disappears</title>
      <link>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3029230#M72634</link>
      <description>&lt;P&gt;I could recreate the same problem when an icon created using Visual studio is used.&lt;/P&gt;&lt;P&gt;Try creating an icon which similar to acad.ico (256 x 256, 32 bit).&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2011 05:12:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3029230#M72634</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2011-05-19T05:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: TrayItem Icon disappears</title>
      <link>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3029362#M72635</link>
      <description>&lt;P&gt;Thanks for reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried both suggestions (acad.ico with 256x256, which is included as embedded resource in the project&amp;nbsp;and adding events to&amp;nbsp;the doument)&amp;nbsp;but with no success. So I simplyfied my code to generate this TrayItem by executing a command.&lt;/P&gt;&lt;P&gt;Here is the codesnipe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;static Autodesk.AutoCAD.Windows.TrayItem oneNewTi = null;
&lt;BR /&gt;//Funktion um befehle zu testen[CommandMethod("test")] 
public static void test()
{
    try
    {
           if (oneNewTi == null)
           {
                System.Drawing.Icon ic;

                //Laden des Icons aus der Resourcendatei
                System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();
                System.IO.Stream file = thisExe.GetManifestResourceStream("CAD.Bilder.acadmap.ico");
                &lt;BR /&gt;                //ic = new System.Drawing.Icon(file, 256, 256);
                ic = new System.Drawing.Icon(file);

                oneNewTi = new Autodesk.AutoCAD.Windows.TrayItem();
                oneNewTi.Visible = true;
                oneNewTi.Icon = ic;
                oneNewTi.ToolTipText = "Verbindung";

                //Hinzufügen zur Statusbar und Anzeige aktualisieren
                Application.StatusBar.TrayItems.Add(oneNewTi);
                }&lt;BR /&gt;                &lt;BR /&gt;                Application.StatusBar.Update();
            }
            catch (System.Exception ex)
            {
                Application.ShowAlertDialog("Fehler in Funktion Test.\nMeldung: " + ex.Message);
            }
            finally
            {
                //MainApp.acadFunctions.UpdateApplication();
            }

            //System.Diagnostics.Process.Start	
}&lt;/PRE&gt;&lt;P&gt;It ended with the same behaviour. Executing test-command adds the icon to the statusbar. The icon is visible. When moving mouse-cursor through acadmenu (we do not use multifunction-bar) for example, so that the statusbar is not visible for a short time - icon is gone when statusbar is visible again.&lt;/P&gt;&lt;P&gt;Executing test-command again doesn't make icon visible. There is only the empty space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anybody reproduce this behaviour?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards, thosti&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2011 09:38:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3029362#M72635</guid>
      <dc:creator>Thosti</dc:creator>
      <dc:date>2011-05-19T09:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: TrayItem Icon disappears</title>
      <link>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3029380#M72636</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the solution that worked for me.&lt;/P&gt;&lt;P&gt;When the icon is defined as static&amp;nbsp;global variable then the icon does not disappear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will have a look at my "little icon" in further time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all replies&lt;/P&gt;&lt;P&gt;Thosti&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2011 10:25:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/3029380#M72636</guid>
      <dc:creator>Thosti</dc:creator>
      <dc:date>2011-05-19T10:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: TrayItem Icon disappears</title>
      <link>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/9230810#M72637</link>
      <description>The same code, why come out two icons？</description>
      <pubDate>Sat, 04 Jan 2020 12:36:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trayitem-icon-disappears/m-p/9230810#M72637</guid>
      <dc:creator>tiancao1001</dc:creator>
      <dc:date>2020-01-04T12:36:46Z</dc:date>
    </item>
  </channel>
</rss>

