'MDI View크기조절'에 해당되는 글 1건

  1. 2007.10.26 MDI 에서 View 크기 조절 하기

MSDN URL :  http://msdn2.microsoft.com/en-us/library/2c6ye477(vs.71).aspx



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

void ResizeParentToFit(
   BOOL bShrinkOnly = TRUE 
);

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.





주로 VIEW 클래스의

OnInitialUpdate 함수에서 쓴다.


이 함수를 통해 view 의 크기를 그때 상황에 맞게 조절할수 있다.


다음은 Open CV 라이브러리를 사용해서 그림 파일을 읽어 올경우 그그림 사이즈에 맞기 view 를

크기 조정하는 사용예이다.



void COpenMFCView::OnInitialUpdate()
{

 COpenMFCDoc * pDoc = GetDocument();  // doc 를 가져온다.
 ASSERT_VALID(pDoc);


 CScrollView::OnInitialUpdate();

 CSize sizeTotal;

 if(pDoc->m_cvvImage.GetImage() )
 {
  int height = pDoc->m_cvvImage.Height();
  int width = pDoc->m_cvvImage.Width();
  sizeTotal = CSize(width,height);

 }
 else
 {
  sizeTotal.cx = sizeTotal.cy = 100;
 }
 
 SetScrollSizes(MM_TEXT, sizeTotal);
 ResizeParentToFit(TRUE);
}

Posted by 명혀니
,