ArcObjects Library Reference (Controls)  

IToolbarPalette.MouseIcon Property

Custom mouse icon used if MousePointer is 99.

[Visual Basic .NET]
Public Property MouseIcon As stdole.IPictureDisp
[C#]
public stdole.IPictureDisp MouseIcon {get; set;}
[C++]
HRESULT get_MouseIcon(
  Picture** ppMouseIcon
);
[C++]
HRESULT putref_MouseIcon(
  Picture* ppMouseIcon
);
[C++]

Parameters

ppMouseIcon [out, retval]

  ppMouseIcon is a parameter of type Picture

ppMouseIcon [in]

  ppMouseIcon is a parameter of type Picture

Product Availability

Available with ArcGIS Engine.

Description

The MouseIcon property provides a custom icon that is used when the MousePointer property is set to esriPointerCustom (99).

If the ToolbarPalette has also been added to the ToolbarControl, the ToolbarControl will override the MouseIcon property with the IToolbarControl::MouseIcon property, before the ToolbarPalette is displayed with the IToolbarPalette::PopupPalette method.

Remarks

In most development evironments a cursor (.cur) or icon (.ico) file can be loaded. A cursor contains a custom 'hotspot' location and can be any size. The 'hotspot' location for an icon file defaults to the center of the icon. This property cannot be used to load animated cursor (.ani) files.

To programatically create an object implementing IPictureDisp there is the win32 function OleLoadPicture or helper methods depending on the development environment.

[C#]

For example, the GetIPictureDispFromIcon method in the ESRI.ArcGIS.ADF.COMSupport.OLE namespace.

IToolbarPalette toolbarPalette = (IToolbarPalette) axToolbarControl1.GetItem(0);
Icon icon = new Icon(GetType().Assembly.GetManifestResourceStream(GetType(), "myIcon.ico"));
toolbarPalette.MouseIcon = (stdole.IPictureDisp) ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromIcon(icon);
toolbarPalette.MousePointer = esriControlsMousePointer.esriPointerCustom;
[Visual Basic .NET]

For example, the GetIPictureDispFromIcon method in the ESRI.ArcGIS.ADF.COMSupport.OLE namespace.

Dim toolbarPalette As IToolbarPalette = AxToolbarControl1.GetItem(0)
Dim pIcon As Icon = New Icon(GetType(Form1).Assembly.GetManifestResourceStream(GetType(Form1), "myIcon.ico"))
toolbarPalette.MouseIcon = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromIcon(pIcon)
toolbarPalette.MousePointer = esriControlsMousePointer.esriPointerCustom

See Also

IToolbarPalette Interface