Skip to main content

LayoutControl.CalcHitInfo(Point) Method

Returns information on the layout elements located at the specified point.

Namespace: DevExpress.XtraLayout

Assembly: DevExpress.XtraLayout.v22.2.dll

NuGet Package: DevExpress.Win.Navigation


public BaseLayoutItemHitInfo CalcHitInfo(
    Point hitPoint


Name Type Description
hitPoint Point

A Point structure which specifies the test point coordinates relative to the layout controls top-left corner.


Type Description

A BaseLayoutItemHitInfo object which contains information about the layout elements located at the test point.


Use the CalcHitInfo method to determine which element is located at the specified point. For instance, this can be used when handling the layout control’s Click event to determine which element was clicked. In such cases, pass the current mouse pointer’s coordinates as the method’s parameter.


This example shows how to focus a control within a LayoutControl when a corresponding label is clicked. In the MouseDown event handler, the CalcHitInfo method is used to access a layout item at the current mouse position. If the layout item has a control, the control is focused.

View Example

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraLayout;
using DevExpress.XtraLayout.HitInfo;

namespace LayoutControl_CalcHitInfo {
    public partial class Form1 : Form {
        public Form1() {

        private void layoutControl1_MouseDown(object sender, MouseEventArgs e) {
            LayoutControl lc = sender as LayoutControl;
            BaseLayoutItemHitInfo hi = lc.CalcHitInfo(e.Location);
            LayoutControlItem currentItem = hi.Item as LayoutControlItem;
            if (currentItem == null || hi.HitType != LayoutItemHitTest.TextArea) return;
            if(currentItem.Control != null)
See Also