wenfei
asked on
How to resize a view by calling SetScaleToFitSize()?
I want have the display in a CScrollView-derived view resize correspondingly when I resize the child window. I have called SetScaleToFitSize() in my routine as following:
void CMyView::OnInitialUpdate()
{
CSize size = GetDocument()->GetSize();
CClientDC dc(NULL);
size.cx = MulDiv(size.cx, dc.GetDeviceCaps(LOGPIXELS X), 100);
size.cy = MulDiv(size.cy, dc.GetDeviceCaps(LOGPIXELS Y), 100);
// SetScrollSizes(MM_TEXT, size);
GetParentFrame()->RecalcLa yout();
SetScaleToFitSize(size);
}
The only result is the scroll bar disabled. The picture dose not change. When I resize the window, the picture dose not resize. Is there any other thing I have to do?
Further, I want the view and page is Landscape by default. How can I do that?
void CMyView::OnInitialUpdate()
{
CSize size = GetDocument()->GetSize();
CClientDC dc(NULL);
size.cx = MulDiv(size.cx, dc.GetDeviceCaps(LOGPIXELS
size.cy = MulDiv(size.cy, dc.GetDeviceCaps(LOGPIXELS
// SetScrollSizes(MM_TEXT, size);
GetParentFrame()->RecalcLa
SetScaleToFitSize(size);
}
The only result is the scroll bar disabled. The picture dose not change. When I resize the window, the picture dose not resize. Is there any other thing I have to do?
Further, I want the view and page is Landscape by default. How can I do that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I inserted dc.LPtoDP(&size). Before calling this function, size={767, 1055}, after calling, size={767, 1013}. And the display doesn't change. I thinks I am not on the right way. Could tell me the detail.
Thanks in advance.
void CMyView::OnInitialUpdate()
{
CSize size = GetDocument()->GetSize();
CClientDC dc(NULL);
size.cx = MulDiv(size.cx, dc.GetDeviceCaps(LOGPIXELS X), 100);
size.cy = MulDiv(size.cy, dc.GetDeviceCaps(LOGPIXELS Y), 100);
// SetScrollSizes(MM_TEXT, size);
dc.LPtoDP(&size);
GetParentFrame()->RecalcLa yout();
SetScaleToFitSize(size);
}
Thanks in advance.
void CMyView::OnInitialUpdate()
{
CSize size = GetDocument()->GetSize();
CClientDC dc(NULL);
size.cx = MulDiv(size.cx, dc.GetDeviceCaps(LOGPIXELS
size.cy = MulDiv(size.cy, dc.GetDeviceCaps(LOGPIXELS
// SetScrollSizes(MM_TEXT, size);
dc.LPtoDP(&size);
GetParentFrame()->RecalcLa
SetScaleToFitSize(size);
}
ASKER