<?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: Trying to add icon to button in Inventor plugin in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12310766#M159168</link>
    <description>&lt;P&gt;Thank you so much for your quick relpy&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the Blog you shared i was able to add standard icon, but whatever i do i am not able to make it work for large icon. In the screen shot shared below i want to create an icon like "Team Web" but what i created is "Display name".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed the 16X16 for Standard and 32X32 for Large Icon. I shared the Code i am using and the .png testing files as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please go through them any suggestions will be a lot of help. Thanks in advance&lt;/P&gt;</description>
    <pubDate>Tue, 17 Oct 2023 07:35:17 GMT</pubDate>
    <dc:creator>saikiran.nT432F</dc:creator>
    <dc:date>2023-10-17T07:35:17Z</dc:date>
    <item>
      <title>Trying to add icon to button in Inventor plugin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12308989#M159119</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Iam trying to add an icon in Inventor plugin button but for the following code added icon is not displaying or getting the error saying "Parameter is incorrect" or if i change the line&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim largeIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp(My.Resources.Arturo_Wibawa_Akar_Icon) to&lt;/P&gt;&lt;P&gt;Dim largeIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp("D:\Desktop\Videos\Arturo-Wibawa-Akar-Icon.ico")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;iam using icon with size 96X96 and tried wityh sizes 32X36. 16X16.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help in resloving in this issue is much appreciataed. Thanks in advance.&lt;/P&gt;&lt;P&gt;Public Sub Activate(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean) Implements Inventor.ApplicationAddInServer.Activate&lt;BR /&gt;' Initialize AddIn members.&lt;BR /&gt;g_inventorApplication = addInSiteObject.Application&lt;/P&gt;&lt;P&gt;' Connect to the user-interface events to handle a ribbon reset.&lt;BR /&gt;m_uiEvents = g_inventorApplication.UserInterfaceManager.UserInterfaceEvents&lt;/P&gt;&lt;P&gt;' TODO: Add button definitions.&lt;/P&gt;&lt;P&gt;'Sample to illustrate creating a button definition.&lt;BR /&gt;Dim largeIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp(My.Resources.YourBigImage)&lt;BR /&gt;Dim smallIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp(My.Resources.YourSmallImage)&lt;/P&gt;&lt;P&gt;Dim controlDefs As Inventor.ControlDefinitions = g_inventorApplication.CommandManager.ControlDefinitions&lt;BR /&gt;m_sampleButton = controlDefs.AddButtonDefinition("sampledef", "Toapp", CommandTypesEnum.kShapeEditCmdType, AddInClientID)&lt;/P&gt;&lt;P&gt;m_sampleButton.LargeIcon = largeIcon&lt;BR /&gt;m_sampleButton.SmallIcon = smallIcon&lt;/P&gt;&lt;P&gt;' Add to the user interface, if it's the first time.&lt;BR /&gt;If firstTime Then&lt;BR /&gt;AddToUserInterface()&lt;BR /&gt;End If&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public NotInheritable Class PictureDispConverter&lt;BR /&gt;&amp;lt;DllImport("OleAut32.dll", EntryPoint:="OleCreatePictureIndirect", ExactSpelling:=True, PreserveSig:=False)&amp;gt; _&lt;BR /&gt;Private Shared Function OleCreatePictureIndirect( _&lt;BR /&gt;&amp;lt;MarshalAs(UnmanagedType.AsAny)&amp;gt; ByVal picdesc As Object, _&lt;BR /&gt;ByRef iid As Guid, _&lt;BR /&gt;&amp;lt;MarshalAs(UnmanagedType.Bool)&amp;gt; ByVal fOwn As Boolean) As stdole.IPictureDisp&lt;BR /&gt;End Function&lt;/P&gt;&lt;P&gt;Shared iPictureDispGuid As Guid = GetType(stdole.IPictureDisp).GUID&lt;/P&gt;&lt;P&gt;Private NotInheritable Class PICTDESC&lt;BR /&gt;Private Sub New()&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;'Picture Types&lt;BR /&gt;Public Const PICTYPE_BITMAP As Short = 1&lt;BR /&gt;Public Const PICTYPE_ICON As Short = 3&lt;/P&gt;&lt;P&gt;&amp;lt;StructLayout(LayoutKind.Sequential)&amp;gt; _&lt;BR /&gt;Public Class Icon&lt;BR /&gt;Friend cbSizeOfStruct As Integer = Marshal.SizeOf(GetType(PICTDESC.Icon))&lt;BR /&gt;Friend picType As Integer = PICTDESC.PICTYPE_ICON&lt;BR /&gt;Friend hicon As IntPtr = IntPtr.Zero&lt;BR /&gt;Friend unused1 As Integer&lt;BR /&gt;Friend unused2 As Integer&lt;/P&gt;&lt;P&gt;Friend Sub New(ByVal icon As System.Drawing.Icon)&lt;BR /&gt;Me.hicon = icon.ToBitmap().GetHicon()&lt;BR /&gt;End Sub&lt;BR /&gt;End Class&lt;/P&gt;&lt;P&gt;&amp;lt;StructLayout(LayoutKind.Sequential)&amp;gt; _&lt;BR /&gt;Public Class Bitmap&lt;BR /&gt;Friend cbSizeOfStruct As Integer = Marshal.SizeOf(GetType(PICTDESC.Bitmap))&lt;BR /&gt;Friend picType As Integer = PICTDESC.PICTYPE_BITMAP&lt;BR /&gt;Friend hbitmap As IntPtr = IntPtr.Zero&lt;BR /&gt;Friend hpal As IntPtr = IntPtr.Zero&lt;BR /&gt;Friend unused As Integer&lt;/P&gt;&lt;P&gt;Friend Sub New(ByVal bitmap As System.Drawing.Bitmap)&lt;BR /&gt;Me.hbitmap = bitmap.GetHbitmap()&lt;BR /&gt;End Sub&lt;BR /&gt;End Class&lt;BR /&gt;End Class&lt;/P&gt;&lt;P&gt;Public Shared Function ToIPictureDisp(ByVal icon As System.Drawing.Icon) As stdole.IPictureDisp&lt;BR /&gt;Dim pictIcon As New PICTDESC.Icon(icon)&lt;BR /&gt;Return OleCreatePictureIndirect(pictIcon, iPictureDispGuid, True)&lt;BR /&gt;End Function&lt;/P&gt;&lt;P&gt;Public Shared Function ToIPictureDisp(ByVal bmp As System.Drawing.Bitmap) As stdole.IPictureDisp&lt;BR /&gt;Dim pictBmp As New PICTDESC.Bitmap(bmp)&lt;BR /&gt;Return OleCreatePictureIndirect(pictBmp, iPictureDispGuid, True)&lt;BR /&gt;End Function&lt;BR /&gt;End Class&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 12:52:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12308989#M159119</guid>
      <dc:creator>saikiran.nT432F</dc:creator>
      <dc:date>2023-10-16T12:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to add icon to button in Inventor plugin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12309882#M159142</link>
      <description>&lt;P&gt;use this way:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;m_sampleButton = controlDefs.AddButtonDefinition("sampledef", "Toapp", CommandTypesEnum.kShapeEditCmdType, AddInClientID,"","",smallIcon,largeIcon,ButtonDisplayEnum.kDisplayTextInLearningMode)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Oct 2023 19:43:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12309882#M159142</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2023-10-16T19:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to add icon to button in Inventor plugin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12309975#M159149</link>
      <description>&lt;P&gt;I wrote a blog post/tutorial about addin icons to your buttons. You might find it interesting.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.hjalte.nl/tutorials/61-adding-icons-to-your-buttons" target="_blank"&gt;http://www.hjalte.nl/tutorials/61-adding-icons-to-your-buttons&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;some important points:&lt;/P&gt;
&lt;P&gt;A “standard” size icon is 16 pixels wide and 16 pixels high. A large size icon is 32 wide by 32 high. Inventor is very strict about this. if you get it wrong then it won't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the method PictureDispConverter.ToIPictureDisp(...) will only accept objects of the type "System.Drawing.Icon" or "System.Drawing.Bitmap". Therefore this won't work:&lt;/P&gt;
&lt;P&gt;PictureDispConverter.ToIPictureDisp("D:\Desktop\Videos\Arturo-Wibawa-Akar-Icon.ico")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 20:33:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12309975#M159149</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2023-10-16T20:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to add icon to button in Inventor plugin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12310766#M159168</link>
      <description>&lt;P&gt;Thank you so much for your quick relpy&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the Blog you shared i was able to add standard icon, but whatever i do i am not able to make it work for large icon. In the screen shot shared below i want to create an icon like "Team Web" but what i created is "Display name".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed the 16X16 for Standard and 32X32 for Large Icon. I shared the Code i am using and the .png testing files as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please go through them any suggestions will be a lot of help. Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 07:35:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12310766#M159168</guid>
      <dc:creator>saikiran.nT432F</dc:creator>
      <dc:date>2023-10-17T07:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to add icon to button in Inventor plugin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12351157#M159854</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;About the Issue (Trying to add icon to button in Inventor plugin), i tried all the available methods i could find on the Forums and other online sites with different file sizes. But iam unable to make it work for Large Icon (32X32).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If any one have an idea as how to resolve this please guide me. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 06:51:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-add-icon-to-button-in-inventor-plugin/m-p/12351157#M159854</guid>
      <dc:creator>saikiran.nT432F</dc:creator>
      <dc:date>2023-11-03T06:51:09Z</dc:date>
    </item>
  </channel>
</rss>

