ArcObjects Library Reference  

ToolbarSubMenu

About the Creating toolbar menus that work with the ToolbarControl Sample

[C#]

ToolbarSubMenu.cs

using System;
using ESRI.ArcGIS.SystemUI;

namespace ToolbarMenu
{
	/// <summary>
	/// Summary description for ToolbarSubMenu.
	/// </summary>
	public class ToolbarSubMenu : IMenuDef
	{
		public ToolbarSubMenu()
		{
			//
			// TODO: Add constructor logic here
			//
		}
	
		public void GetItemInfo(int pos, IItemDef itemDef)
		{
			//Commands for the menu - the object browser lists these commands
			switch (pos)
			{
				case 0:
					itemDef.ID = "esriControls.ControlsMapUpCommand";
					break;
				case 1:
					itemDef.ID = "esriControls.ControlsMapDownCommand";
					break;
				case 2:
					itemDef.ID = "esriControls.ControlsMapLeftCommand";
					break;
				case 3:
					itemDef.ID = "esriControls.ControlsMapRightCommand";
					break;
				case 4:
					itemDef.ID = "esriControls.ControlsMapPageUpCommand";
					itemDef.Group = true;
					break;
				case 5:
					itemDef.ID = "esriControls.ControlsMapPageDownCommand";
					break;
				case 6:
					itemDef.ID = "esriControls.ControlsMapPageLeftCommand";
					break;
				case 7:
					itemDef.ID = "esriControls.ControlsMapPageRightCommand";
					break;
			}
		}
	
		public string Caption
		{
			get
			{
				return "SubMenu";
			}
		}
	
		public int ItemCount
		{
			get
			{
				return 8;
			}
		}
	
		public string Name
		{
			get
			{
				return "SubMenu";
			}
		}
	}
}

[Visual Basic .NET]

ToolbarSubMenu.vb

Option Strict Off
Option Explicit On
Friend Class ToolbarSubMenu
	Implements ESRI.ArcGIS.SystemUI.IMenuDef
	
	Private ReadOnly Property IMenuDef_Caption() As String Implements ESRI.ArcGIS.SystemUI.IMenuDef.Caption
		Get
			Return "SubMenu"
		End Get
	End Property
	
	Private ReadOnly Property IMenuDef_ItemCount() As Integer Implements ESRI.ArcGIS.SystemUI.IMenuDef.ItemCount
		Get
			Return 8
		End Get
	End Property
	
	Private ReadOnly Property IMenuDef_Name() As String Implements ESRI.ArcGIS.SystemUI.IMenuDef.Name
		Get
			Return "SubMenu"
		End Get
	End Property
	
	Private Sub IMenuDef_GetItemInfo(ByVal pos As Integer, ByVal itemDef As ESRI.ArcGIS.SystemUI.IItemDef) Implements ESRI.ArcGIS.SystemUI.IMenuDef.GetItemInfo
		Select Case pos 'Commands for the menu - the object browser lists these commands
			Case 0
                itemDef.ID = "esriControls.ControlsMapUpCommand"
			Case 1
                itemDef.ID = "esriControls.ControlsMapDownCommand"
			Case 2
                itemDef.ID = "esriControls.ControlsMapLeftCommand"
			Case 3
                itemDef.ID = "esriControls.ControlsMapRightCommand"
			Case 4
                itemDef.ID = "esriControls.ControlsMapPageUpCommand"
				itemDef.Group = True
			Case 5
                itemDef.ID = "esriControls.ControlsMapPageDownCommand"
			Case 6
                itemDef.ID = "esriControls.ControlsMapPageLeftCommand"
			Case 7
                itemDef.ID = "esriControls.ControlsMapPageRightCommand"
		End Select
	End Sub
End Class