ArcObjects Library Reference  (SystemUI)    

ICommand.Bitmap Property

The bitmap that is used as the icon on this command.

[Visual Basic 6.0]
Property Bitmap As OLE_HANDLE
[Visual Basic .NET]
Public ReadOnly Property Bitmap As Integer
[C#]
public int Bitmap {get;}
[Java]
public OLEHANDLE getBitmap()
throws
    IOException,
    AutomationException
[C++]
HRESULT get_Bitmap(
  OLE_HANDLE* Bitmap
);
[C++]

Parameters

Bitmap [out, retval]

  Bitmap is a parameter of type OLE_HANDLE

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

When implementing ICommand to create a custom command, use the Bitmap property to set the bitmap to be used as the icon on this command. In your Visual Basic project for this command, the bitmap can be stored in a resource file or in a PictureBox control on a form.

You must use a Bitmap file (.bmp) for the Bitmap property; Icon files (.ico) are not supported. Bitmap files should be 16 X 16 pixels. The color of the upper left pixel of the bitmap is treated as the transparent color. For example, if the upper left pixel of the bitmap is red, then all of the red pixels in the bitmap will be converted to transparent.

When a command is put on a toolbar, the command is displayed with the bitmap only by default; the display type is set to Image Only (ICommandItem::Style = esriCommandStyleIconOnly). When a command is put on a menu, the command is displayed with the bitmap and caption by default; the display type is set to Image and Text (ICommandItem::Style = esriCommandStyleIconAndText). However, if the Bitmap property is not set for this command, then the command will be displayed with the caption only by default when it is put on a toolbar or menu; the display type is set to Text Only (ICommandItem::Style = esriCommandStyleTextOnly).

[Visual Basic 6.0]

Here is an example of loading the bitmap from a resource file.

 Dim m_pBitmap As IPictureDisp       'Bitmap for the command
 
Private Sub Class_Initialize()
  'Load the button image from the resource file.
  Set m_pBitmap = LoadResPicture(105, 0)
End Sub
 
Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE
  ' Set the bitmap of the command. The m_pBitmap variable is set in 
  ' Class_Initialize.
  ICommand_Bitmap = m_pBitmap
End Property

Here is an example of loading the bitmap from a PictureBox on a form.

Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE
  ' The VB project contains a form called Form1.
  ' PictureBox1 is the name of a PictureBox control on the form.
  ' The Picture property of Picture1 is set to some bitmap on 
  ' your system. 
  ICommand_Bitmap = Form1.Picture1.Picture.Handle   
End Property

See Also

ICommand Interface

Example

ICommand Example

 


Feedback Send feedback on this page