This document is archived and information here might be outdated.  Recommended version.


IToolbarControlDefault.MouseIcon Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarControlDefault Interface > IToolbarControlDefault.MouseIcon Property
ArcGIS Developer Help

IToolbarControlDefault.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(
void
);
[C++]
HRESULT putref_MouseIcon(
);

Product Availability

Available with ArcGIS Engine.

Description

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

Dim pToolbarControl As IToolbarControlDefault
pToolbarControl = AxToolbarControl1.Object
Dim pIcon As Icon
pIcon = New Icon(GetType(Form1).Assembly.GetManifestResourceStream(GetType(Form1), "myIcon.ico"))
pToolbarControl.MouseIcon = ESRI.ArcGIS.Utility.COMSupport.OLE.GetIPictureDispFromIcon(pIcon)
pToolbarControl.MousePointer = esriControlsMousePointer.esriPointerCustom

Remarks

In most development evironments the control's property pages can be used to load either a cursor (.cur) or icon (.ico) file. 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#]

When working directly with AxControls class use the MouseIcon property as follows:

axToolbarControl1.MouseIcon = new Icon("myIcon.ico");
axToolbarControl1.MousePointer = esriControlsMousePointer.esriPointerCustom;

When using the Controls interop assembly use the MouseIcon property as follows:

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

When working directly with AxControls class use the MouseIcon property as follows:

AxToolbarControl1.MouseIcon = New Icon("myIcon.ico")
AxToolbarControl1.MousePointer = esriControlsMousePointer.esriPointerCustom

When using the Controls interop assembly use the MouseIcon property as follows:

Dim toolbarControl As IToolbarControlDefault = AxToolbarControl1.Object
Dim myIcon As Icon = New Icon(GetType(Form1).Assembly.GetManifestResourceStream(GetType(Form1), "myIcon.ico"))
toolbarControl.MouseIcon = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromIcon(myIcon)
toolbarControl.MousePointer = esriControlsMousePointer.esriPointerCustom

See Also

IToolbarControlDefault Interface