This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > ITOCControl2 Interface > ITOCControl2.HitTest Method (ArcObjects .NET 10.4 SDK) |
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
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.
IBasicMap map=null; ILayer layer=null; Object other=null; Object index=null; esriTOCControlItem item=esriTOCControlItem.esriTOCControlItemNone; axTOCControl1.HitTest(e.x, e.y,ref
item,ref
map,ref
layer,ref
other,ref
index);
Dim
pMapAs
IMap=Nothing Dim
pLayerAs
ILayer=Nothing Dim
pOtherAs Object
=Nothing Dim
pItemAs
esriTOCControlItemDim
pIndexAs Object
=Nothing
AxTOCControl1.HitTest(e.x, e.y, pItem, pMap, pLayer, pOther, pIndex)