Solved

CFromView?

Posted on 1998-11-15
3
231 Views
Last Modified: 2013-11-20
Hi All,

I have chosen CFormView as the base class to implement my project.

How can the size of each control component will display accoring to the resolution of the computer using?
Now I am facing a problem that the size of the component in my view will be too large when I am using the resolution 640x480(horizontal and vertical sroll bar will appear in this case). However the size will be too small while using the resolution 1280x1076.

I have used the command
ResizeParentToFit(FALSE);
in the function OnInitialUpdate()

Can anyone give me advice?

Thanks!!!
0
Comment
Question by:cplau
[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
3 Comments
 
LVL 2

Accepted Solution

by:
wyy_cq earned 50 total points
ID: 1324747
i am sorry to tell you that there is no easy and simple way to implement that.

because formView use the resource definition and the resource is not permitted to be changed in runtime directly.

there are two ways:

1.define three formView dialog.one for 640/480,one for 800/600 and one for 1024/768. the ID of the dialog will be different but the id of the child control can be same.
your appliction check the resolution and load the proper resource.in this case you need to override many virtual in the CFrameWnd class to load the resource which not named IDR_MAINFRAME .

2.move and size the control in runtime.
you can use MoveWindow(...) and change the coordinate between the client and the screen, this is a easier way.
but let's image a single-line edit control change its size,you will have a margin in the control.
0
 
LVL 1

Expert Comment

by:V245
ID: 1324748
'...the resource is not permitted to be changed in runtime directly' - to my mind it isn't means that we have to create resources as many possible screen resolution we have. FormView is a dialog window and we can set an appropriate size to it in runtime.
0
 
LVL 1

Expert Comment

by:payn
ID: 1324749
You may want to look at one of the many libraries that resize controls when their parent windows are resized. CodeGuru (www.codeguru.com) is full of them on the Dialogs page. Most of the code will have to be adapted to work on CFormView instead of CDialog, but it's relatively simple and painless.

The basic idea of all of these solutions is that each control has a set of constraints that determine whether and how it moves and/or grows when the dialog changes size. Go look at them and see if it helps at all.

0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

630 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