01-20-2010 11:47 AM
Hi, I am using custom implementation for zooming & panning to fit our needs, so I am not using the InteractionMode /InteractionModeDefault (they are always none)
However, I would like to be able to change the mouse cursor according to my own current mode.
Is there a way I can tell the graph to change it's cursor on the plot area?
Thanks in advance!
01-21-2010 09:19 AM
Marvin,
The graph should have a property called cursor that you set equal to any of the available cursors on the system. These can be accessed by typing "Cursors." after the equal sign and allowing IntelliSense to pop-up and list the cursors available to you. As such, the line of code becomes WaveformGraphName.Cursor = Cursors.DesiredCursor. I placed this line within the MouseEnter event for the Waveform Graph and sure enough, the cursor changed to whatever I indicated in the code when I moused over the graph. Let me know what versions of Visual Studio and Measurement Studio you are using, and I'd be glad to create a small example for you that exhibits this functionality.
01-21-2010 09:53 AM
Hi Gist,
Thank you four your response.
I have already tried you solution. However, I need the cursor to change when I hover the Plot area only. With your solution, the cursor is changed wherever I am in the graph, including the axes. I would need to reproduce the same behavior as when using the InteractionModeDefault (the cursor only changes in the plot area)
I tried to move the code on the PlotAreaMouseHover event but this doesn't work.
I include an image to clarify. Notice the mouse cursor in the y axis, it is a zoom cursor. That is my problem...
For your information, I am using VS 2005 and Measurement studio 8.6.20.465
Thank you very much.
01-21-2010 11:12 AM
Hello Marvin,
If that is the case, use the MouseMove event of the Waveform Graph in conjunction with the parameter called "e" that it automatically provides for you in order to detect the location of the mouse. That is, identify a rectangle that constitutes the plot area and if the mouse is in that area change the cursor to your desired cursor. If it is outside of that area, revert to the original cursor. I have attached an example exhibiting this approach that has been created with Visual Studio 2005 and Measurement Studio 8.5.
01-27-2010 04:38 AM
05-11-2011 02:28 AM
Hi, I am using Measurement Studio 2010 (V9.0.0.292). I would like to change cursor when mouse enters the Knob object.
The code below does not work although it works with the e.g Switch object:
private void knob1_MouseEnter(object sender, EventArgs e)
{
knob1.Cursor=Cursors.Arrow;//This code DOES NOT change hand cursor to arrow cursor
}
private void switch1_MouseEnter(object sender, EventArgs e)
{
switch1.Cursor=Cursors.Arrow;//This code WORKS properly
}
Thank you very much.
Laseno.
05-12-2011 10:28 AM - edited 05-12-2011 10:30 AM
Laseno,
The cursor property is not a valid property in the knob property. Switch inherits the property from the 'controlbase' class while knob does not, unfortunately.
In the help file, it shows the inheritance heirarcy to be :
You may be able to find a workaround using some of the other properties, such as innerbounds or just by using the physical location (and height/width) of the knob.
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments
05-12-2011 11:55 AM
Laseno,
My mistake, I looked up the WebControls version of the Knob class instead of the WindowsFroms version. It seems that the windowsforms version does have the cursor property, and we have successfuly reproduced the issue here. Were currently looking into why this behavior happens.
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments
05-12-2011 03:35 PM
Laseno,
I think I have found a better solution to the issue. Instead of using the knob.cursor property, you can set the default behavior using the InteractionMouseCursors property, which can be seen here for an arbitrary control. I think this will use less overhead and be a more robust solution.
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments
05-16-2011 08:18 AM
Hi, Kyle.
Thank you very much for your information.
I could try some workarounds.
I think I am going to that direction. I have tried to cover the knob by a text label
and define some events on it...
Sincerely,
Laseno