Solved

Resizing Controls in CFormView

Posted on 2001-07-10
5
457 Views
Last Modified: 2013-11-20
I have a CFormView derived view class that has some static rectangle controls in the dialog template.

I would like to resize the controls in my dialog template when the user resizes the application.  

I was thinking I would need to override CWnd::OnSize().  In my override, I would need to get the coordinates of my controls and recalculate new sizes and locations of them based on how big the client area is after the resize.  Is this the way to go?


Any help greatly appreciated!
0
Comment
Question by:klingej
[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
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
ID: 6271897
Hi!
you right it is proportional resizing method.
in general you have to done several steps:
1.store old size of the view
2.Catch OnSize message
3. calc proportional coefficiens : coeff = sizeNew/sizeoOld;
4.enumerate all child window in the form by GetWindow API
5. Resize all window according calculated coefficient
6.store new size as old (for next resizing).
0
 
LVL 12

Expert Comment

by:migel
ID: 6285133
Hi!
do you have additional Q?
It is very hard answer you without your response :-)
0
 

Author Comment

by:klingej
ID: 6286148
The general flow of your answer was right, but I ran into problems with one of the controls - an owner drawn CBitmapButton object.

However, I didn't have time to finish implementing this and finding the problem with the bitmap button.
0
 
LVL 12

Expert Comment

by:migel
ID: 6286169
In this case additional Q. will be preffered instead grading 'B'.
0
 

Author Comment

by:klingej
ID: 6286197
No time for additional questions...    plus I had to change a lot of the suggested solution to get it to work, thus the B grade.
0

Featured Post

Industry Leaders: 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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 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