Solved

How to resize a view by calling SetScaleToFitSize()?

Posted on 1998-02-04
3
1,130 Views
Last Modified: 2013-11-19
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(LOGPIXELSX), 100);
      size.cy = MulDiv(size.cy, dc.GetDeviceCaps(LOGPIXELSY), 100);
//      SetScrollSizes(MM_TEXT, size);
      GetParentFrame()->RecalcLayout();
      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?
0
Comment
Question by:wenfei
  • 2
3 Comments
 

Author Comment

by:wenfei
ID: 1315588
Edited text of question
0
 
LVL 2

Accepted Solution

by:
AlFa earned 100 total points
ID: 1315589
Size must be teh size of your document in logical units.
SetScaleToFitSize will change the scale of your view in orderto display the whole doc. you won't have scrolllbar!

0
 

Author Comment

by:wenfei
ID: 1315590
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(LOGPIXELSX), 100);
      size.cy = MulDiv(size.cy, dc.GetDeviceCaps(LOGPIXELSY), 100);
//      SetScrollSizes(MM_TEXT, size);
      dc.LPtoDP(&size);
      GetParentFrame()->RecalcLayout();
      SetScaleToFitSize(size);
}

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now