J
Jaap Bos
In VB2005 I use a rectangle (50,50,910,600) into which to display my
graphics.
After graphing my X-Y data I want to do some measurements on that curve
using a crosshair cursor.
So I a made a MouseDoubleClick event with the following code:
Dim position as Point
position=Control.MousePostion
tijd=position.X
height=position.Y
Now it seems that the height is in screencoordinates, not in
graphicscoordinates, e.g. if I doubleclick on the topline of my rectangle I
get height=76 pixels, instead of 50 pixels (the difference of 26 pixels is
the height of the forms titelbar). This difference of course becomes larger
with a form that is not maximized.
Now I can live with that by always using a maximized screen and substracting
26 from the position.Y, but that does not seems not very elegant.
Is there a better way to get the coordinates in a graphics window in
graphicscoordinates?
graphics.
After graphing my X-Y data I want to do some measurements on that curve
using a crosshair cursor.
So I a made a MouseDoubleClick event with the following code:
Dim position as Point
position=Control.MousePostion
tijd=position.X
height=position.Y
Now it seems that the height is in screencoordinates, not in
graphicscoordinates, e.g. if I doubleclick on the topline of my rectangle I
get height=76 pixels, instead of 50 pixels (the difference of 26 pixels is
the height of the forms titelbar). This difference of course becomes larger
with a form that is not maximized.
Now I can live with that by always using a maximized screen and substracting
26 from the position.Y, but that does not seems not very elegant.
Is there a better way to get the coordinates in a graphics window in
graphicscoordinates?