CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2010
    Posts
    17

    Displaying Mouse co-ordinates in an edit box

    I'm working on a dialog based MFC. I have used a Picture Box Control to draw a rectangle and written the code for drawing in the picture box using a sperate class inherited from CStatic (Pict Class). I wish to capture the mouse co-ordinates as it moves inside the Picture box(only) and display the co-ordintaes to the user on the Dialog screen using an edit box. i have handled the onMouseMove function to get the co-ordinates. But i'm facing the difficulty to display it to the user. Can somebody please help me out in this. I want the edit to display the refreshed co-ordinates as soon as the mouse moves inside the Picture Box. I'm attaching the PictureCtrlDlg.cpp and the Pict.cpp file for refrence.
    Attached Files Attached Files

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Displaying Mouse co-ordinates in an edit box

    With the approach you have started, ou need to get the mouse coordinates from the CPoint that's passed into OnMouseMove, format them into m_value, then call UpdateData.

    I'd go for a CStatic rather than a CEdit.

  3. #3
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Re: Displaying Mouse co-ordinates in an edit box

    Apart from above suggestion .Why not put a tooltip on Mouse pointer itself . Instead of using any third control .

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured