Solved

How to resize a view by calling SetScaleToFitSize()?

Posted on 1998-02-04
3
1,157 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Detect CR LF to each line 12 184
format the code in java 6 115
Problem to event 3 121
ERP and the other system process verification 5 22
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: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

739 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