AnsweredAssumed Answered

Changing icon on AddIn Button

Question asked by bnording on Nov 11, 2015
Latest reply on Nov 17, 2015 by Hornbydd

I have a bit of code that toggles the icon of an Addin button:

 

isChecked = Not isChecked
Dim pUID As New UIDClass
pUID.Value = My.ThisAddIn.IDs.FloorCBX
Dim pCI As ICommandItem
Dim bm As Bitmap
pCI = My.ArcMap.Application.Document.CommandBars.Find(pUID, True, True)

 

If isChecked Then
  bm = New Bitmap("E:\customnet\spacedemo\Images\FloorCBX2.png")
Else
  bm = New Bitmap("E:\customnet\spacedemo\Images\FloorCBX.png")
End If
'Dim bm As New Bitmap("E:\customnet\spacedemo\Images\FloorCBX2.png")
pCI.FaceID = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(bm)

 

While this works on my development machine, it obviously won't elsewhere due to the hard-coded image file paths. I have seen in the "Build Action" of the image that I can set it to "AddInContent", but I have not found any info on how to reference that embedded bitmap in my code. So, how do I modify my code to get the bitmap from the Addin's content instead of a file?

Outcomes