HitTestResult 类
定义
表示命中测试的结果。Represents the results of a hit test.
public ref class HitTestResult
public class HitTestResult
type HitTestResult = class
Public Class HitTestResult
- 继承
-
HitTestResult
注解
HitTestResult类表示命中测试的结果,并作为从方法调用返回的对象公开 HitTest 。The HitTestResult class represents the results of a hit test, and is exposed as the return object from a HitTest method call.
命中测试检查图表中的指定点,以确定图表元素是否位于该点。A hit test checks a specified point in the chart to determine if a chart element is located at that point. 如果检测到图表元素,则 HitTestResult 使用类获取有关该图表元素的信息。If a chart element is detected, the HitTestResult class is used to obtain information about that chart element.
如果找到图表元素,则该 Object 属性返回对图表元素的引用; 这是对象的唯一例外 DataPoint ,在这种情况下,此属性的返回值为 null 。If a chart element is found, the Object property returns a reference to the chart element; the only exception to this being DataPoint objects, in which case the return value of this property is null.
如果找到了数据点,则可以使用 PointIndex 属性来获取该数据点的索引,即中点的从零开始的索引 DataPointCollection 。If a data point is located, you can use the PointIndex property to get the index of that data point; that is, the zero-based index of the point in the DataPointCollection. 使用 Series 属性可获取 Series 该数据点的关联对象。Use the Series property to get the associated Series object for that data point.
ChartArea和 Axis 属性用于获取图表元素(如果有)由命中测试返回的关联图表区和轴。The ChartArea and Axis properties are used to get the associated chart area and axis of the chart element - if any - returned by the hit test. 请注意, null 如果返回的图表元素没有关联的图表区或轴,则这些属性可能为。Note that these properties may be null if the returned chart element does not have an associated chart area or axis.
使用 ChartElementType 属性可确定命中测试返回的图表元素的类型。Use the ChartElementType property to determine the type of the chart element returned by a hit test.
构造函数
| HitTestResult() |
初始化 HitTestResult 类的新实例。Initializes a new instance of the HitTestResult class. |
属性
| Axis |
获取或设置可与命中测试返回的图表元素相关联的 Axis 对象。Gets or sets the Axis object that may be associated with a chart element returned by a hit test. 关联的 Axis 对象是否存在取决于在给定的位置是否检测到图表元素,以及所返回的图表元素的类型。The presence of an associated Axis object depends on whether a chart element was detected at the given location, and the type of chart element returned. |
| ChartArea |
获取或设置可与命中测试返回的图表元素相关联的 ChartArea 对象。Gets or sets the ChartArea object that may be associated with a chart element returned by a hit test. ChartArea 对象是否存在取决于在给定的位置是否检测到图表元素,以及所返回的图表元素的类型。The presence of a ChartArea object depends on whether a chart element was detected at the given location, and the type of chart element returned. |
| ChartElementType |
获取或设置命中测试返回的图表元素(如果有)的类型。Gets or sets the type of chart element, if any, returned by a hit test. |
| Object |
获取或设置命中测试返回的对象(如果有)。Gets or sets the object, if any, returned by a hit test. |
| PointIndex |
获取或设置命中测试返回的数据点(如果有)的索引。Gets or sets the index of a data point, if any, returned by a hit test. |
| Series |
获取或设置命中测试返回的数据点(如果有)的关联序列。Gets or sets the associated series of a data point, if any, returned by a hit test. |
| SubObject |
获取命中测试返回的子对象(如果有)。Gets the sub-object, if any, returned by a hit test. |
方法
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |