Solved

CFromView?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

759 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

21 Experts available now in Live!

Get 1:1 Help Now