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


IToolbarMenu2.MouseIcon Property (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Controls)  

IToolbarMenu2.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 esriPointerArrowHourglass (99).

If the ToolbarMenu has also been added to the ToolbarControl, the ToolbarControl will override the MouseIcon property with the IToolbarControl::MouseIcon property, before the ToolbarMenu is displayed with the IToolbarMenu::PopupMenu 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.

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

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

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

See Also

IToolbarMenu2 Interface