windowsforms-devexpress-dot-xtradiagram-dot-diagramcontrol-dot-calchititem-x28-system-dot-drawing-dot-pointf-x29.md
Returns the diagram item located at the specified position.
Namespace : DevExpress.XtraDiagram
Assembly : DevExpress.XtraDiagram.v25.2.dll
NuGet Package : DevExpress.Win.Diagram
public DiagramItem CalcHitItem(
PointF diagramRelativePoint
)
Public Function CalcHitItem(
diagramRelativePoint As PointF
) As DiagramItem
| Name | Type | Description |
|---|---|---|
| diagramRelativePoint | PointF |
A test point where a target element is located.
|
| Type | Description |
|---|---|
| DiagramItem |
A diagram item located at the specified position.
|
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CalcHitItem(PointF) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
How-to-execute-an-arbitrary-action-when-a-diagram-item-is-clicked-winforms/CS/DXSample/Form1.cs#L22
private void diagramControl1_Click(object sender, EventArgs e) {
var clickedItem = diagramControl1.CalcHitItem(((MouseEventArgs)e).Location);
if (clickedItem is DiagramItem item) {
How-to-execute-an-arbitrary-action-when-a-diagram-item-is-clicked-winforms/VB/DXSample/Form1.vb#L17
Private Sub diagramControl1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim clickedItem = diagramControl1.CalcHitItem(CType(e, MouseEventArgs).Location)
Dim item As DiagramItem = Nothing
See Also