This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarMenu2 Interface > IToolbarMenu2.MouseIcon Property (ArcObjects .NET 10.5 SDK) |
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
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.
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.
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;
For example, the GetIPictureDispFromIcon method in the ESRI.ArcGIS.ADF.COMSupport.OLE namespace.
Dim
toolbarMenuAs
IToolbarMenu2=AxToolbarControl1.GetItem(0)Dim
pIconAs
Icon=New
Icon(GetType
(Form1).Assembly.GetManifestResourceStream(GetType
(Form1), "myIcon.ico")) toolbarMenu.MouseIcon=ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromIcon(pIcon) toolbarMenu.MousePointer=esriControlsMousePointer.esriPointerCustom