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

    Coordinates of picture control

    Hi everyone,
    I am having problems with getting coordinates for
    my picture control rectangle.
    This is the code I have.....

    CRect myPictureArea;
    picture.GetClientRect(&myPictureArea);//picture is variable I assign top picture control
    POINT p;
    p=myPictureArea.TopLeft();
    int x=p.x;
    int y=p.y;

    But both x and y are returning 0

    Anyone has any suggestions on this please.

    Thanks

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Coordinates of picture control

    Anyone has any suggestions on this please.
    Read MSDN on GetClientRect.

    The GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).
    Use GetWindowRect instead.

  3. #3
    Join Date
    Jan 2009
    Posts
    69

    Re: Coordinates of picture control

    Yeah that worked great but I had to also use ScreenToClient.
    Thanks so much

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