Solved

How to resize a view by calling SetScaleToFitSize()?

Posted on 1998-02-04
3
1,119 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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 …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

20 Experts available now in Live!

Get 1:1 Help Now