Skip to main content

ImageSlider.CalcHitInfo(Point) Method

Returns information on the image slider elements located at the specified point.

Namespace: DevExpress.XtraEditors.Controls

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public virtual ImageSliderHitInfo CalcHitInfo(
    Point hitPoint
)

Parameters

Name Type Description
hitPoint Point

A System.Drawing.Point structure specifying the test point coordinates relative to the top-left corner of the ImageSlider control.

Returns

Type Description
DevExpress.XtraEditors.Controls.ImageSliderHitInfo

An ImageSliderHitInfo object containing information about the image slider elements located at the test point.

Remarks

Use the CalcHitInfo method to determine which element is located at the specified point. This method returns the ImageSliderHitInfo object. Read the ImageSliderHitInfo.HitTest property of the ImageSliderHitTest type to get the ImageSlider‘s visual element to which the test point belongs. The ImageSliderHitTest enumeration provides the following values:

  • Image — the test point belongs to the image.
  • LeftButton — the test point belongs to the previous image button
  • RightButton — the test point belongs to the next image button
  • None — the test point does not belong to the ImageSlider control

ImageSlider_ImageSliderHitTest

Example

The following code demonstrates how to determine over which element of the ImageSlider the mouse pointer is located.

In the following example, the MouseMove event of the ImageSlider is handled. The ImageSlider.CalcHitInfo method is called to determine over which element the mouse pointer is located. The retrieved information is used to slide images.

using DevExpress.XtraEditors.Controls;

//...

private void imageSlider1_MouseMove(object sender, MouseEventArgs e) {
    ImageSliderHitInfo ishi = imageSlider1.CalcHitInfo(e.Location);
    ImageSliderHitTest isht = ishi.HitTest;
    switch (isht) {
        case ImageSliderHitTest.LeftButton:
            imageSlider1.SlidePrev();
            break;
        case ImageSliderHitTest.RightButton:
            imageSlider1.SlideNext();
            break;
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CalcHitInfo(Point) 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.

See Also