Issues while setting m_Bitmap of BaseCommand. FaceID value is null.

604
3
Jump to solution
12-11-2013 08:54 AM
Highlighted
Occasional Contributor II
Hello,

I have created one custom command inheriting from BaseCommand. I want to access the bitmap of  few ArcMap built in commands, like say "Create New version..." and use it to set m_Bitmap property of my base command.

Below is my code.

  private void SetBitmap()         {             try             {                 ESRI.ArcGIS.esriSystem.UID pUID = new ESRI.ArcGIS.esriSystem.UIDClass();                 ESRI.ArcGIS.Framework.ICommandItem pCmdItem;                  pUID.Value = "{b87d4f92-6d39-4675-a0b5-553b15342ae1}"; //  //8E8F4C7F-ACA7-11D2-9F19-00C04F6BC979                 pCmdItem = m_application.Document.CommandBars.Find(pUID); //get builtin command item                  //set my tool's bitmap using Bitmap of the retrieved command item.                 this.m_bitmap = pCmdItem.FaceID as Bitmap;                 //base.m_bitmap = pCmdItem.FaceID as Bitmap;                  //I get the error at below line since FaceID value is null.                 this.UpdateBitmap(pCmdItem.FaceID as Bitmap);                               }             catch (Exception ex)             {             }         } 


My problem is, FaceID value is null and hence I can't set m_Bitmap property of my BaseCommand. Sometimes, for some commands I get the value back, but if I cast FaceID to Bitmap, null value is what I get.

I am using 10.2 and Windows 7 x64. This code used to work on older ArcGIS versions, like pre 10.

So, if anybody has been successful to get the FaceId value and use it to set BitMap property of the BaseCommand, please let me know.

Any help is appreciated.

Thanks.
S.
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Occasional Contributor II
For anyone, who is interested, I found icons for all ArcGIS tools in SDK installation at C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\Icons. This folder contains the zip file and all PNGs used for all commands and tools. I used images from this folder as embedded resoure and fixed the issue.

Thanks,
S.

View solution in original post

Reply
0 Kudos
3 Replies
Highlighted
Regular Contributor III
Instead of using FaceId have you tried using the command's bitmap directly?  ICommandItem.Command.Bitmap.  Also, most if not all of the bitmaps used by ArcMap are imbedded in the arcmap.exe file.  You can open this file in Visual Studio and export out the bitmap you want.
Reply
0 Kudos
Highlighted
Occasional Contributor II
Thanks Neil for the reply.

I found that ICommandItem does not have property of Command, it does not have Bitmap property. So, can't use that. And, as per the documentation, IApplicationRefreshBitmap.RefreshBitmap  should be used. However,I could not find more information on this interface. So, can't figure out how to use it.

Any other idea?

Thanks,
S.
Reply
0 Kudos
Highlighted
Occasional Contributor II
For anyone, who is interested, I found icons for all ArcGIS tools in SDK installation at C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\Icons. This folder contains the zip file and all PNGs used for all commands and tools. I used images from this folder as embedded resoure and fixed the issue.

Thanks,
S.

View solution in original post

Reply
0 Kudos