• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 469
  • Last Modified:

Resizing Controls in CFormView

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
klingej
Asked:
klingej
  • 3
  • 2
1 Solution
 
migelCommented:
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
 
migelCommented:
Hi!
do you have additional Q?
It is very hard answer you without your response :-)
0
 
klingejAuthor Commented:
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
 
migelCommented:
In this case additional Q. will be preffered instead grading 'B'.
0
 
klingejAuthor Commented:
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

Technology Partners: 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!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now