Back to Devexpress

ChartControl.QueryCursor Event

windowsforms-devexpress-dot-xtracharts-dot-chartcontrol-2a6a5e51.md

latest2.8 KB
Original Source

ChartControl.QueryCursor Event

Occurs when there is a request to display the cursor.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.UI.dll

NuGet Package : DevExpress.Win.Charts

Declaration

csharp
public event QueryCursorEventHandler QueryCursor
vb
Public Event QueryCursor As QueryCursorEventHandler

Event Data

The QueryCursor event's data class is QueryCursorEventArgs. The following properties provide information specific to this event:

PropertyDescription
CursorGets or sets the mouse cursor currently being shown for the chart.
CursorTypeGets the cursor type.

Remarks

In the QueryCursor event handler, you can provide custom cursors for your chart in various circumstances (e.g. when a chart is being scrolled or zoomed).

Example

This example demonstrates how to substitute the Hand and Grab cursors shown when a chart’s area is being scrolled with a default system cursor.

To do this, handle the ChartControl.QueryCursor event, and use the QueryCursorEventArgs.Cursor and QueryCursorEventArgs.CursorType properties.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...
private void chartControl1_QueryCursor(object sender, QueryCursorEventArgs e) {
    if (e.CursorType == CursorType.Hand || e.CursorType == CursorType.Grab) {
        e.Cursor = Cursors.Default;
    }
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraCharts
' ...
Private Sub chartControl1_QueryCursor(ByVal sender As Object, ByVal e As QueryCursorEventArgs) Handles chartControl1.QueryCursor
    If e.CursorType = CursorType.Hand OrElse e.CursorType = CursorType.Grab Then
        e.Cursor = Cursors.Default
    End If
End Sub

See Also

ChartControl Class

ChartControl Members

DevExpress.XtraCharts Namespace