Archived

This topic is now archived and is closed to further replies.

MFC window resizing not working

This topic is 5047 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having problems resizing my dialogbox in MFC. My window needs to be the same size as the bottom of a button + 10. When pressing the button the window is resized to show an extra control which isn''t always needed. Moving it onto a different tab or in a new window isn''t really an option, since the control relies on a different one aswell. What is wrong with this code:
    CRect WndSize;
    CRect BtnPos;
    // m_pgBlack is derived from CPropertyPage

    m_pgBlack.m_btnCalendar.GetWindowRect(&BtnPos);
    m_pgBlack.GetWindowRect(&WndSize);
    ScreenToClient(&WndSize);
    ScreenToClient(&BtnPos);
    WndSize.right  -= WndSize.left;
    WndSize.bottom = BtnPos.bottom;
This is the result, I removed some of the interface, since I dunno if they would like it if I showed around the interface.

Share this post


Link to post
Share on other sites
Oops, seems like I got the
SetWindowPos(NULL, Rect.left, Rect.top, Rect.right, Rect.bottom, SWP_NOZORDER);
call.

I am resizing the propertypage, can I use Movewindow for that aswell? I just try and see wat happens.

Toolmaker



-Earth is 98% full. Please delete anybody you can.

Share this post


Link to post
Share on other sites