Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

General XYPoint Annotation Questions

Hello,

I had a few questions regarding the general usage of XYPoint annotations on a scatter point graph.

1)  Is is possible to use an image to represent an annotation?  If so, how?

2)  Is there any native support for annotations reacting to mouse events build in to MS.net?

Thanks,

Chris
0 Kudos
Message 1 of 4
(3,879 Views)

1) Is is possible to use an image to represent an annotation? If so, how?

Yes, you can do this by creating an image FillStyle via the FillStyle.FromImage method, then assign this FillStyle to the XYPointAnnotation.ShapeFillStyle property. For example:

XYPointAnnotation annotation = new XYPointAnnotation(xAxis1, yAxis1, 5.0, 5.0);
 
// Make the shape a little larger so that the image can be seen more clearly.
annotation.Caption = "Image annotation";
annotation.ShapeStyle = ShapeStyle.Rectangle;
annotation.ShapeSize = new Size(50, 50);
 
// Create an image fill style and set annotation shape fill style to this style.
Image img = Image.FromFile(@"C:\Windows\FeatherTexture.bmp");
annotation.ShapeFillStyle = FillStyle.FromImage(img, ImageAlignment.Stretch);
 
// Add the annotation to the graph.
scatterGraph1.Annotations.Add(annotation);

2) Is there any native support for annotations reacting to mouse events build in to MS.net?

Yes, but only for the caption of the annotation. See the ScatterGraph.InteractionMode and XYPointAnnotation.InteractionMode properties. Interactive captions are enabled by default. Usually if you want to interact with the point you will want to use a cursor instead of an annotation.

- Elton

0 Kudos
Message 2 of 4
(3,867 Views)
Is there a preferred method for dealing with click, double, click , mouse down, mouse up, ect. on an xypoint annotation?

Thank you for your assistance,

Chris
0 Kudos
Message 3 of 4
(3,866 Views)

It depends - what are you trying to do? In general, you'll probably want to use the graph's PlotAreaMouse* events, then use the graph's GetAnnotationAt method to check to see if the mouse is interacting with an annotation, get a reference to the annotation, then make updates to the annotation.

- Elton

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