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 .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Draw rectangles

Hi!
 
I'm using Measurement Studio 7.1.
I have the problem to get a rectangle into a graph which shows
measurement data.
This rectangle should be as scrollable and zoomable as the
graph but my rectangle i insert is fix on the screen.

e.Graphics.DrawRectangle(

new Pen(Color.Turquoise,2),10,10,50,50);//   works!!! but without scrolling and zooming

 
Hope you can help me.
0 Kudos
Message 1 of 7
(3,659 Views)

Are you using the rectangle to highlight a region of data? Have you tried using a range annotation instead?
To add a range annotation, right click on the graph, select "Edit Annotation..." and then in the collection editor, select Add >> XYRangeAnnotation.

This should take zooming and panning into account.

I hope this helps


Bilal Durrani
NI
0 Kudos
Message 2 of 7
(3,638 Views)
Thank you for reply.
It is a little bit of that i want to have.
This rectangle 'window' should be able to move and
edit(runtime), something like a rubberband rectangle.
I need this for my measurement data graph in which i
will insert this window to control if my graph is in this range.
Hope you understand me.
 
Seconde Question.
How get I single lines in my graph which are also can be moved and
edited?
 
Thanks
M.Friedel
 
0 Kudos
Message 3 of 7
(3,623 Views)

This is my result. All I want works, but it is very inexect in the area auf the

edge points. Can anyone help me?

Another Problem is to use this one outside, i.e with a ButtonClick.

 

 

PointF point1 = e.Plot.MapDataPoint(e.Bounds, 1.0, 1.0);

PointF ZeroPoint = e.Plot.MapDataPoint(e.Bounds, 0.0, 0.0);

PointF point5 = e.Plot.MapDataPoint(e.Bounds, 1.0, 1.0);

Point point6 = new Point(Math.Abs((int)point5.X - (int)ZeroPoint.X), Math.Abs((int)point5.Y - (int)ZeroPoint.Y));

Size mySize = new Size(point6);

Point point7 = new Point((int) point1.X, (int) point1.Y);

e.Graphics.DrawRectangle(new Pen(Color.Turquoise,3), new Rectangle( point7, mySize) );

 

0 Kudos
Message 4 of 7
(3,586 Views)

Could you attach a sample of your app? It'll give me a better idea of what the problem might be

Thanks

Bilal Durrani
NI
0 Kudos
Message 5 of 7
(3,576 Views)

I just want code with that i can handle the problem to

get a rectangle which is able to move in the graph and

able to change the size. I should can click on one edge

of the rectangle an set the edgepoint new on the graph.

 

0 Kudos
Message 6 of 7
(3,559 Views)

Ok, everything in the project works...

now i have to solve the problem with the rectangles....

this is a kind of example project, which shows my problem.

 

now after the rectangle is painted in the graph

i want to be able zo click on an edge of this rectangle

and change the location of the edge.

hope you understand me.

 

regards

Friedel

0 Kudos
Message 7 of 7
(3,419 Views)