07-28-2009 07:57 AM
When Using
Waveformgraph.Annotations.Add( {new annotation in here} )It adds the new annotation to the graph’s annotations collection but does not seem to display the new annotation on the graph. Annotations already present in the annotations collection are displayed.
This behavior indicates that the graph annotation display is updating before the new annotation is added to the collection.
Is this a bug? or is there a refresh command for the annotations that I could use?
A simple example is: -
Public Class Form1
Private Sub WaveformGraph1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles WaveformGraph1.KeyDown
With WaveformGraph1
Select Case e.KeyCode
Case Keys.Space
Call addMarker(.Cursors.Item(0).XPosition, .Cursors.Item(0).YPosition)
Case Keys.A
Call addMarker1(.Cursors.Item(0).XPosition, .Cursors.Item(0).YPosition)
End Select
End With
End Sub
Public Sub addMarker(ByVal x As Double, ByVal y As Double)
Dim m_Marker As XYPointAnnotation = New XYPointAnnotation
With m_Marker
.SetPosition(x, y)
End With
WaveformGraph1.Annotations.Add(m_Marker)
End Sub
Public Sub addMarker1(ByVal x As Double, ByVal y As Double)
Dim m_Marker As XYPointAnnotation = New XYPointAnnotation
With m_Marker
.SetPosition(x, y)
End With
WaveformGraph1.Annotations.Add(m_Marker)
'workaround
Dim dummy As XYPointAnnotation = New XYPointAnnotation
dummy.SetPosition(0, 0)
WaveformGraph1.Annotations.Add(dummy)
WaveformGraph1.Annotations.Remove(dummy)
End Sub
End Class
Using the spacebar shows this bug, whilst using Key A shows a Work around whereby adding and removing a dummy forces a redraw.
Regards
StevieB
08-10-2009 04:10 AM
Hi StevieB,
I have been looking into this and as far as I can find it is not a known issue.
What version of Measurement Studio are you using? I am not aware of any refresh function that should be required.
Have you built the code into a compiled exe? If so can you post this for me to test with.
What are the results if you add multiple plots?
Regards,
John
09-08-2009 08:16 AM
John,
Sorry for being late returning your questions but I have been of leave and other work intervened.
Answers to your questions as follows: -
1. Visual Studio 2008 SP1
2. Measurement Studio 8.6
3. Attached Solution in zip.
4. Bug ocurrs with Executable.
5. Will try with multiple plots
Regards
Steve