Solved

CFromView?

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

734 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