Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a different interaction mode to two cursors

I have two cursors in one scatterGraph.  The operation mode of the first cursor is dragXY.  I do not want the user to be able to drag the second cursor.  is there a way to have the second cursor respond to "mouse click" while the second cursor can be dragged? 

 

Thanks,

yajai

0 Kudos
Message 1 of 3
(4,512 Views)

Hi there,

 

I quickly tested moving the second cursor depending on if you move the first one. Its quiet easy if you hook on to the XYCursor.AfterMove event.

 

Here is the code snippet!

 

    public partial class Form1 : Form
    {
        // offset the values as you like.
        private double xOffset = 2;
        private double yOffset = 2;

        public Form1()
        {
            InitializeComponent();

            // use either ToPlot or Floating for the 1st cursor
            xyCursor1.SnapMode = NationalInstruments.UI.CursorSnapMode.ToPlot;
            xyCursor2.SnapMode = NationalInstruments.UI.CursorSnapMode.Fixed;
            SetCursorPosition2();

            // some data on the graph
            scatterGraph1.PlotXY(new double[] { 1, 2, 3, 5, 6, 8, 4, 2 }, new double[] { 1, 2, 3, 5, 6, 8, 4, 2 });
        }

        private void SetCursorPosition2()
        {
            xyCursor2.XPosition = xyCursor1.XPosition + xOffset;
            xyCursor2.YPosition = xyCursor1.YPosition + yOffset;
        }

        private void xyCursor1_AfterMove(object sender, NationalInstruments.UI.AfterMoveXYCursorEventArgs e)
        {
            SetCursorPosition2();
        }
    }

 

Cheers!!

 

Vijet Patankar

National Instruments

Message 2 of 3
(4,508 Views)

Thank you! It works very well.

0 Kudos
Message 3 of 3
(4,504 Views)