Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

custom annotations

I need to use custom annotations in my graphs. I choosed to draw the shapes myself, using a different icon for each of my custom annotations.

It looks like that :


_annotation.AfterDraw += new NationalInstruments.UI.AfterDrawXYPointAnnotationEventHandler( AnnotationIconDrawnEventHandler );

and

private void AnnotationIconDrawnEventHandler( object sender, NationalInstruments.UI.AfterDrawXYPointAnnotationEventArgs e )
{
int positionX = (int) e.ShapePoint.X;
int positionY = (int) e.ShapePoint.Y;

e.Graphics.DrawIcon( _icon, positionX, positionY );
}



I only wanted to know if it was the good approach.


Pipo

PS : sorry about mass posting this week but I m also mass coding -_- thank you for your time

PS : some measurement studio event doesnt follow MSDN naming guidlines (they should be called Dragging/Dragged instead of BeforeDrag/AfterDrag), but I guess it is a coding standard choice from the team.
0 Kudos
Message 1 of 3
(3,825 Views)
"I only wanted to know if it was the good approach."

This approach is fine. Another approach would be to set the ShapeStyle property to ShapeStyle.Rectangle, set the ShapeSize property to the size of your image, then create an image FillStyle with FillStyle.FromImage, and set the ShapeFillStyle property with this FillStyle.

"PS : some measurement studio event doesnt follow MSDN naming guidlines (they should be called Dragging/Dragged instead of BeforeDrag/AfterDrag), but I guess it is a coding standard choice from the team."

In general, we are pretty strict about following the .NET naming conventions. In this case, it may have been that we established this pattern for the custom drawing events in the first release of our .NET controls before this convention existed. This pattern was based on a pattern that's used in other Windows Forms controls, such as TreeView's Before/After Check/Collapse/Expand/Select events. It's also a little awkward to apply the conventions to the custom drawing events - Drawing/Drawn instead of BeforeDraw/AfterDraw? Anyway, thanks for pointing this out and we will be more conscious of it for new events that we add, but we will probably stick to the Before/After pattern for the custom drawing events for consistency with the existing events.

- Elton
Message 2 of 3
(3,812 Views)

To all,

 

My goal is to be able to add custom annotations (jpegs) to a waveform graph as it is acquiring data.  I was thinking of setting up the VI so that one could simply click an "add annotations" button that would switch when pressed, then click any number of  locations on the waveform graph with the mouse and have the custom annotations appear at these points.  When the user is finished adding annotations, they could simply click the "add annotations" button again to return it to a false value.  Any suggestions on how to do this?

 

Thus far, I have been able to get a single jpeg annotation to appear at any desired location, but I would like to do more, maybe five or so.  But, an unlimited number would be nice.

 

Thanks,

Owen

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