windowsforms-devexpress-dot-xtracharts-dot-chartcontrol-2a6a5e51.md
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
public event QueryCursorEventHandler QueryCursor
Public Event QueryCursor As QueryCursorEventHandler
The QueryCursor event's data class is QueryCursorEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Cursor | Gets or sets the mouse cursor currently being shown for the chart. |
| CursorType | Gets the cursor type. |
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).
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.
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;
}
}
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