Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CFromView?

Posted on 1998-11-15
3
Medium Priority
?
234 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
3 Comments
 
LVL 2

Accepted Solution

by:
wyy_cq earned 100 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Loops Section Overview
Suggested Courses

916 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