Solved

CFromView?

Posted on 1998-11-15
3
220 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 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
viewing source code from eclipse 13 110
ffmpeg - "rtsp://...... Operation not permitted" 4 86
only14 challenge 19 81
fizzArray2 challenge 1 91
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

830 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