Solved

Scaling CFormView

Posted on 1998-06-17
5
346 Views
Last Modified: 2013-11-20
I have written an order enty program that uses a CFormView dialog resource as the main screen.  The PC I used to develop the code was in 800 X 600 mode.  Now that other users are using the program, they are getting annoying scroll bars even when in 800 X 600 and without any other desktop interference (Office Bar, Start Bar, etc)
My ultimate goal is to resize the CFormView to fit at either 640 X 480, 800 X 600, and 1024X768.  How do programmers usually deal with different display settings?  Also, why are there scroll bars on every other system at 800 X 600 but not on mine?  I have tried using various combinations of SetScaleToFitSize() and GetParentFrame()->RecalcLayout() which eliminate the scroll bars but don't show the entire form. If its important the form contains a tree, listview, a RichEdit, and a bank of buttons at the top.  I can live without the status bar if necessary.  Thanks!
0
Comment
Question by:badges
5 Comments
 

Author Comment

by:badges
ID: 1318122
Edited text of question
0
 

Author Comment

by:badges
ID: 1318123
VC++ 5 Win95
0
 
LVL 2

Expert Comment

by:Belgarat
ID: 1318124
How should the controls on the form do after you resize it ? Should they change their sizes accordingly / move around ? Or do you want them to stick in upper left area of the resized dialog window ?

0
 
LVL 3

Accepted Solution

by:
shaig earned 100 total points
ID: 1318125
Use:
::GetSysInfo()    ( or GetSysMetrics, i don't remmember which )

you can also query the desktop window about it's size.
0
 

Expert Comment

by:alesatang
ID: 1318126
The Contradiction Between Flexibility and Rapid Development
-The condition of Dialog-based Windows and Size-Position Adaptation
Alesa Tang
Shanghai Bell SNA
98.6
Many programmer suffer pains when image to exploit the CFormView, CRecordView or CDialogBar to implement a Interface Rapidly and precisely. Because if the window*s size and position change, the dialog*s appearance will always be out of control. This kind difficulties are not only in VC, but also other tools like VB or Delphi.
Yes, its is easy to use dialog editor to locate the controls* position, size. But the dialog template has fixed physical location. The alternative is create the control dynamically as a child window in a view or controlbar. But these processes seem to be a little more laborious So a developer should make compromization when choose Rapid Develop or Flexibility.
Before make decision, the analysis should be taken carefully. There is two category of interface controls:
--Flexible Controls: CEdit, CTreeCtrl, CListCtrl,
--Not so flexible: Buttons, Radios, Checkboxes.
Which category is dominate in a interface? If the Flexible controls is major part, like the ClassView of the Visual Studio, a dynamic strategy should be selected. If you want outstanding effect, the labor is valuable. Other wise, the dialog template path might be better.
There is some factors shoul be take into consideration when create dynamic control:
1. The parent window*s OnSize should adjust the these child controls size and Position, like:
void COutputWnd::OnSize(UINT nType, int cx, int cy)
{
      CControlBar::OnSize(nType, cx, cy);
      if(cx>0)
      {
            RECT rc;
            GetClientRect(&rc);
            m_TabCtrl.MoveWindow(&rc);
            rc.left+=5;rc.right-=5;
            rc.top+=28;rc.bottom-=5;
            m_Terminal.MoveWindow(&rc);
            m_Terminal.RedrawWindow();
            m_AlarmHisList.MoveWindow(&rc);
      }
}

2. In dynamic controls case, if the 3D effect is wanted, you should draw some border lines manually.
Ref.
The Dockable PropertySheet in C++ topic group


0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

11 Experts available now in Live!

Get 1:1 Help Now