//
axMapMain的右击菜单
private
IToolbarMenu mapMenu
=
new
ToolbarMenuClass();
///
<summary>
///
为axMapMain定义右击菜单
///
</summary>
private
void
AddMapMainPopuMenu()
{
//
progID添加
string
progID
=
"
CSharpDotNETCommands.MapPan
"
;
mapMenu.AddItem(progID,
-
1
,
-
1
,
false
, esriCommandStyles.esriCommandStyleIconAndText);
progID
=
"
CSharpDotNETCommands.MapZoomIn
"
;
mapMenu.AddItem(progID,
-
1
,
-
1
,
true
, esriCommandStyles.esriCommandStyleIconAndText);
progID
=
"
CSharpDotNETCommands.MapZoomOut
"
;
mapMenu.AddItem(progID,
-
1
,
-
1
,
true
, esriCommandStyles.esriCommandStyleIconAndText);
progID
=
"
CSharpDotNETCommands.MapFullExtent
"
;
mapMenu.AddItem(progID,
-
1
,
-
1
,
true
, esriCommandStyles.esriCommandStyleIconAndText);
progID
=
"
CSharpDotNETCommands.MapGoBack
"
;
mapMenu.AddItem(progID,
-
1
,
-
1
,
true
, esriCommandStyles.esriCommandStyleIconAndText);
progID
=
"
CSharpDotNETCommands.MapGoForward
"
;
mapMenu.AddItem(progID,
-
1
,
-
1
,
true
, esriCommandStyles.esriCommandStyleIconAndText);
mapMenu.SetHook(axMapMain);
//
axMapMain右键菜单
}
/// <summary>
/// axMapMain右击菜单
/// </summary>
private void axMapMain_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e)
{
if (e.button == 2)
{
mapMenu.PopupMenu(e.x, e.y, axMapMain.hWnd);
}
}