Tuesday 11 February 2020

arcobjects - Can you programmatically change the button image for a ESRI.ArcGIS.Desktop.AddIns.Button?


I'm new to the AddIn customization model in ArcGIS 10 and I'm trying to figure out how to change a button image for a button. I'm looking for the equivalent to the BaseCommand UpdateBitmap method and haven't had any luck. Is this a limitation of the AddIn model? Or did I miss something obvious?



Answer



Ok, I've worked something out using ICommandItem.FaceID. I wasn't initially thinking of using ICommandItem, but it gets the job done.


ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find(...;
commandItem.FaceID = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(bitmap);

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...