ArcObjects Library Reference (Controls)  

ITOCControl.HitTest Method

Returns the item in the TOCControl at the specified coordinates.

[Visual Basic .NET]
Public Sub HitTest ( _
    ByVal X As Integer, _
    ByVal Y As Integer, _
    ByRef ItemType As esriTOCControlItem, _
    ByRef BasicMap As IBasicMap, _
    ByRef Layer As ILayer, _
    ByRef Unk As Object, _
    ByRef Data As Object _
)
[C#]
public void HitTest (
    int X,
    int Y,
    ref esriTOCControlItem ItemType,
    ref IBasicMap BasicMap,
    ref ILayer Layer,
    ref object Unk,
    ref object Data
);
[C++]
HRESULT HitTest(
  long X,
  long Y,
  esriTOCControlItem* ItemType,
  IBasicMap** BasicMap,
  ILayer** Layer,
  LPUNKNOWN* Unk,
  VARIANT* Data
);
[C++]

Parameters

X [in]   X is a parameter of type long Y [in]   Y is a parameter of type long ItemType [in, out]

  ItemType is a parameter of type esriTOCControlItem

BasicMap [in, out]

  BasicMap is a parameter of type IBasicMap

Layer [in, out]

  Layer is a parameter of type ILayer

Unk [in, out]   Unk is a parameter of type LPUNKNOWN Data [in, out]   Data is a parameter of type VARIANT

Product Availability

Available with ArcGIS Engine.

Description

x is the X coordinate, in pixels, where the mouse button was pressed referenced against the origin (0, 0) of the TOCControl (the top left hand corner).

y is the Y coordinate, in pixels, where the mouse button was pressed referenced against the origin (0, 0) of the TOCControl (the top left hand corner).

ItemType specifies an enumeration indicating the type of item (none, map, layer, heading or legend class).

Map specifies an IMap object.

Layer specifies an ILayer object.

Unk specifies an ILegendGroup object.

Data specifies a long indicating the index of the legend class within the legend group. Use this index in conjunction with the legend group to obtain a particular legend class. An index of -1 refers to the heading if it is present.

[C#]
IMap map = null; 
ILayer layer = null; 
Object other = null;
Object index = null;
esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;

AxTOCControl1.HitTest(e.x, e.y, item, map, layer, other, index);
[Visual Basic .NET]
Dim pMap As Map = Nothing
Dim pLayer As ILayer = Nothing
Dim pOther As Object = Nothing
Dim pItem As esriTOCControlItem
Dim pIndex As Object = Nothing

AxTOCControl1.HitTest(e.x, e.y, pItem, pMap, pLayer, pOther, pIndex)

See Also

ITOCControl Interface

.NET Samples

TOCControl metadata viewer (Code Files: MetadataViewer)