Mouse cursors and actions

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
ahe
Posts: 51
Joined: Tue Aug 11, 2015 4:33 pm
Location: Düsseldorf, DE

Mouse cursors and actions

Post by ahe » Tue Jan 19, 2016 1:55 pm

Is there a way to replace all internal mouse cursors graphics with custom ones? For example, we would like to change the panning cursor from the 4-way-hand to a grabbing-hand and the default cursor from arrow to normal hand.

Also, since we need the right mouse button for a context menu, all mouse actions have to be done via modifier keys (shift/control). This I implemented by using the KeyUp/KeyDown events:

Code: Select all

        void Chart_KeyDownXY(object sender, KeyEventArgs e)
        {
            var zpo = Chart.ViewXY.ZoomPanOptions;

            if (e.Shift && e.Control)
            {
                zpo.MouseWheelZooming = MouseWheelZooming.HorizontalAndVertical;
            }
            else if (e.Shift)
            {
                // Zoom-Action
                zpo.LeftMouseButtonAction = MouseButtonAction.Zoom;
                Chart.Cursor = Cursors.Cross;

                zpo.MouseWheelZooming = MouseWheelZooming.Horizontal;
            }
            // ... more ...
        }

        void Chart_KeyUpXY(object sender, KeyEventArgs e)
        {
            var zpo = Chart.ViewXY.ZoomPanOptions;

            zpo.MouseWheelZooming = MouseWheelZooming.HorizontalAndVertical;
            zpo.LeftMouseButtonAction = MouseButtonAction.Pan;
            Chart.Cursor = Cursors.Default;
        }
Unfortunately, this does not work very well, especially using Shift to change the mode is not fast enough so you end up panning instead. Can you recommend a better way to implement this?

I don't know how far you are with v7, but would you consider switching the properties around? In Helix3D for example, one can write:

Code: Select all

base.PanGesture2 = new MouseGesture(MouseAction.LeftClick);
base.RotateGesture = new MouseGesture(MouseAction.LeftClick, System.Windows.Input.ModifierKeys.Control);
--Andreas

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Mouse cursors and actions

Post by ArctionPasi » Tue Jan 19, 2016 2:25 pm

The custom cursors are as embedded resources in LightningChart dll. Replacing the cursors would need LightningChart source code subscription. There you modify the cursors to your preference and rebuild the assemblies.

By setting chart.AllowInternalMouseCursorCharge = False, the chart won't change any cursors internally. Your custom-side code applies.

Upcoming LC v.7 has for example configurable middle mouse button.
LightningChart Support Team, PT

Post Reply