Back to Devexpress

ZoomingOptions.ZoomInMouseAction Property

corelibraries-devexpress-dot-xtracharts-dot-zoomingoptions-bdd45bed.md

latest4.8 KB
Original Source

ZoomingOptions.ZoomInMouseAction Property

Returns the action used to zoom in to the chart.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public ChartMouseAction ZoomInMouseAction { get; }
vb
Public ReadOnly Property ZoomInMouseAction As ChartMouseAction

Property Value

TypeDescription
ChartMouseAction

The action to zoom in the chart.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ZoomInMouseAction
Diagram3D

.ZoomingOptions .ZoomInMouseAction

|

Remarks

To specify the action used to zoom in to the chart, define the ChartMouseAction.ModifierKeys and ChartMouseAction.MouseButton properties.

Example

This example demonstrates how to change predefined shortcuts and mouse actions that a user can use to zoom in/out the diagram.

Use the following properties to specify the shortcuts:

The properties below allow you to define the mouse actions:

csharp
using DevExpress.XtraCharts;
using System;
using System.Windows.Forms;
// . . .
private void OnFormLoad(object sender, EventArgs e) {
    XYDiagram xyDiagram = chartControl1.Diagram as XYDiagram;

    // Enable scrolling and zooming for both axes.
    xyDiagram.EnableAxisXZooming = true;
    xyDiagram.EnableAxisYZooming = true;
    xyDiagram.EnableAxisXScrolling = true;
    xyDiagram.EnableAxisYScrolling = true;

    // Click the left mouse button while the Shift key pressed to zoom in to the diagram.
    xyDiagram.ZoomingOptions.ZoomInMouseAction.ModifierKeys = ChartModifierKeys.Shift;
    xyDiagram.ZoomingOptions.ZoomInMouseAction.MouseButton = MouseButtons.Left;

    // Click the left mouse button while the Ctrl key pressed to zoom out of the diagram.
    xyDiagram.ZoomingOptions.ZoomOutMouseAction.ModifierKeys = ChartModifierKeys.Control;
    xyDiagram.ZoomingOptions.ZoomOutMouseAction.MouseButton = MouseButtons.Left;

    // Press Alt + M to zoom in to the diagram.
    xyDiagram.ZoomingOptions.ZoomInShortcuts.Add(Keys.Alt | Keys.M);
    // Press Alt + P to zoom out of the diagram.
    xyDiagram.ZoomingOptions.ZoomOutShortcuts.Add(Keys.Alt | Keys.P);
}
vb
Imports DevExpress.XtraCharts
Imports System
Imports System.Windows.Forms
' . . .
Private Sub OnFormLoad(ByVal sender As Object, ByVal e As EventArgs)
    Dim xyDiagram As XYDiagram = CType(chartControl1.Diagram,XYDiagram)

    ' Enable scrolling and zooming for axes.
    xyDiagram.EnableAxisXZooming = true
    xyDiagram.EnableAxisYZooming = true
    xyDiagram.EnableAxisXScrolling = true
    xyDiagram.EnableAxisYScrolling = true

    ' Click the left mouse button while the Shift key pressed to zoom in to the diagram.
    xyDiagram.ZoomingOptions.ZoomInMouseAction.ModifierKeys = ChartModifierKeys.Shift
    xyDiagram.ZoomingOptions.ZoomInMouseAction.MouseButton = MouseButtons.Left

    ' Click the left mouse button while the Ctrl key pressed to zoom out of the diagram.
    xyDiagram.ZoomingOptions.ZoomOutMouseAction.ModifierKeys = ChartModifierKeys.Control
    xyDiagram.ZoomingOptions.ZoomOutMouseAction.MouseButton = MouseButtons.Left

    ' Press Alt + M to zoom in to the diagram.
    xyDiagram.ZoomingOptions.ZoomInShortcuts.Add((Keys.Alt Or Keys.M))
    ' Press Alt + P to zoom out of the diagram.
    xyDiagram.ZoomingOptions.ZoomOutShortcuts.Add((Keys.Alt Or Keys.P))
End Sub

See Also

ZoomingOptions Class

ZoomingOptions Members

DevExpress.XtraCharts Namespace