AnsweredAssumed Answered

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

Question asked by sanjayjadhav on Dec 11, 2013
Latest reply on Dec 11, 2013 by sanjayjadhav
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.

Outcomes