coordinates

Hi all!
I'm new in mfc programming and i have a problem.
I'm trying to display the x,y coordinates of the mouse while the cursor is in the drawing area but i don't know how.
how could i do it? any idea or suggestion??
thanks

Mikael Aronsson's picture

What kind of coordinates are you talking about ? is this an MFC question or a OCC question ?

The mouse coordinates are available in the mouse message, but I guess you want some kind mapping to coordinates in the view as you are asking on the OCC forum ?

But that depends on what you have in your view, if you display a 3D coordinate system you cannot map mouse coordinates in 2D to 3D without some reference to Z, you could do some picking and if you have something under the cursor you can map that to a 3D coordinate but that's it.

If you do display a coordinate system where two axis are aligned with the screens X/Y axsis you can of course map you mouse coordinate top 3D, just find out the 3D coordinate in the lower left corner of your view, then you can calculate the 3D coordinate with a scale and add.

ion.balasa's picture

it's a mfc question. i'm trying to modify a 2d sample('2D Basic' or "2D Geometry") that i found in Open cascade and i'd like to display somewhere the only the X,Y coordinates of the cursor when i move it on the drawing area. did you understand what i want to do ?? i read somewhere that i could use the onMouseMove event but i dont know how.
thanks.