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

    picture control to use as a 2D graph

    Hi,
    I am trying to build a 2d graphic in my program. I started using the picture control, using it as rectangle.
    What I am not being able to do is to get the size of this window (picture frame) using API.
    To update the frame I paint a white rectangle inside the picture control and them I draw some lines. but to paint this white rectangle I need to know the size of the picture frame.

    here it goes a peace of my code where I update the window cleanning it before. I have never used GDI before and now I am a bit confuded with everyting I am seing of new...I am trying to stand always on API...If anyone can help I thanks...

    Quote Originally Posted by rafraf
    bool graph2D::update()
    {
    int i;
    HDC hdc = NULL;
    if (hframe==0) return FALSE;
    hdc = GetWindowDC(hframe);

    SelectObject(hdc , GetStockObject(WHITE_BRUSH));
    Rectangle(hdc , 0 , 0 , 100 , 100); // here I should put the size of picture control to clear frame but I dont know how to get its size

    //code continues drawing simple stuff...

    // release the DC
    ReleaseDC(hframe, hdc);
    return TRUE;
    }
    Last edited by rafraf; February 14th, 2005 at 01:34 PM.

  2. #2
    Join Date
    Nov 2004
    Posts
    67

    Re: picture control to use a a 2D graph

    GetClientRect() is in client coordinates
    GetWindowRect() is in screen coordinates

  3. #3
    Join Date
    Oct 2004
    Posts
    38

    Re: picture control to use a a 2D graph

    Thanks,
    It was easy like this...shame on me....

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