In this topic
Using add-ins
Creating an add-in is the easiest and recommended way to implement a custom tool palette. For more information on using add-ins, see Building add-ins for ArcGIS for Desktop.
Extending ArcObjects
You can also use the classic Component Object Model (COM) extensibility model to implement a custom tool palette. In this case, create a COM command and implement IToolPalette. You can create a command by implementing ICommand or by having your class inherit from BaseCommand. For more information, see Creating commands and tools.
When implementing IToolPalette, you must specify the tools you want to appear and whether they will be listed menu or palette style. With palette style, you must specify the number of columns; the number of rows is automatically determined at run time to satisfy the count. The following screen shot shows a menu style tool palette:
The following screen shot shows the same tool palette in palette style, with menu style set to false:
The following code excerpt shows an example implementation:
[C#] #region IToolPalette Members
public bool MenuStyle
{
get
{
return false;
}
}
public int PaletteColumns
{
get
{
return 2;
}
}
public int PaletteItemCount
{
get
{
return 5;
}
}
public bool TearOff
{
get
{
return false;
}
}
public string get_PaletteItem(int pos)
{
switch (pos)
{
case 0:
return "esriArcMapUI.SelectFeaturesTool";
case 1:
return "esriArcMapUI.SelectByPolygonTool";
case 2:
return "esriArcMapUI.SelectByLassoTool";
case 3:
return "esriArcMapUI.SelectByCircleTool";
case 4:
return "esriArcMapUI.SelectByLineTool";
}
return "";
}
#endregion
[VB.NET] #Region "IToolPalette Members"
Public ReadOnly Property MenuStyle() As Boolean
Get
Return False
End Get
End Property
Public ReadOnly Property PaletteColumns() As Integer
Get
Return 2
End Get
End Property
Public ReadOnly Property PaletteItemCount() As Integer
Get
Return 5
End Get
End Property
Public ReadOnly Property TearOff() As Boolean
Get
Return False
End Get
End Property
Public Function get_PaletteItem(ByVal pos As Integer) As String
Select Case pos
Case 0
Return "esriArcMapUI.SelectFeaturesTool"
Case 1
Return "esriArcMapUI.SelectByPolygonTool"
Case 2
Return "esriArcMapUI.SelectByLassoTool"
Case 3
Return "esriArcMapUI.SelectByCircleTool"
Case 4
Return "esriArcMapUI.SelectByLineTool"
End Select
Return ""
End Function
#End Region