Bagikan melalui


CScrollView::ResizeParentToFit

Call ResizeParentToFit to let the size of your view dictate the size of its frame window.

void ResizeParentToFit( 
   BOOL bShrinkOnly = TRUE  
);

Parameters

  • bShrinkOnly
    The kind of resizing to perform. The default value, TRUE, shrinks the frame window if appropriate. Scroll bars will still appear for large views or small frame windows. A value of FALSE causes the view always to resize the frame window exactly. This can be somewhat dangerous since the frame window could get too big to fit inside the multiple document interface (MDI) frame window or the screen.

Remarks

This is recommended only for views in MDI child frame windows. Use ResizeParentToFit in the OnInitialUpdate handler function of your derived CScrollView class. For an example of this member function, see CScrollView::SetScrollSizes.

ResizeParentToFit assumes that the size of the view window has been set. If the view window size has not been set when ResizeParentToFit is called, you will get an assertion. To ensure that this does not happen, make the following call before calling ResizeParentToFit:

GetParentFrame()->RecalcLayout();

Requirements

Header: afxwin.h

See Also

Reference

CScrollView Class

Hierarchy Chart

CView::OnInitialUpdate

CScrollView::SetScrollSizes

Other Resources

CScrollView Members