From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Get plot cursor position DURING cursor move.

Solved!
Go to solution

Hi, 

I am using MS 2013 with Vstudio 2010.

During dragging plot cursor by mouse, the current cursor positon is dynamically updated while it is moved.

However, the "scatterGraph.Cursors[0].XPosition" is only updated on event "AfterMove", when cursor is released.

I want to dynamycally change caption of the plot WHILE cursor is moved, like:

private void scatterGraph1_CursorChanged(object sender, EventArgs e) {
scatterGraph.Caption = "X=" + scatterGraph.Cursors[0].XPosition.ToString("#00.0") + ", Y=" + scatterGraph.Cursors[0].YPosition.ToString("0#.0");

}

During move, this even is fired, but Xposition Yposition do not change until mouse button is released.

I can see dynamic changes on a plot in the small box attached to cursor, however I cannot find a way to extract position of the cursor before mouse is released.

How I can do it?

Thanks, Igor

 

0 Kudos
Message 1 of 3
(3,562 Views)

There is a BeforeMoveCursor event that you can use.  Is it possible to call that and constantly update the position values?  Here's the online documentation on it.

 

http://zone.ni.com/reference/en-XX/help/375857A-01/html/e_nationalinstruments_ui_windowsforms_xygrap...

0 Kudos
Message 2 of 3
(3,521 Views)
Solution
Accepted by topic author IgorKord

Thank you,

I made it working, but used AfterMoveCursor event:

private void scatterGraph_AfterMoveCursor(object sender, NationalInstruments.UI.AfterMoveXYCursorEventArgs e) {
     var Xpos = e.Cursor.XPosition;
     var Ypos = e.Cursor.YPosition;
     scatterGraph.Caption = "X=" + Xpos.ToString("#00.0") + ", Y=" + Ypos.ToString("0#.0"); 
}

Igor

0 Kudos
Message 3 of 3
(3,516 Views)