Solved

resizing an MDI parent window

Posted on 1997-07-09
2
469 Views
Last Modified: 2013-11-20
I need to resize the parent window in an MDI app, after
the program has started, so I can't override
PreCreateWindow. I'm displaying an image in the child
window, so I need to wait until I have loaded it to
resize the parent to be exactly the size of the image; is
there a command to resize the main frame?
0
Comment
Question by:nicholso
2 Comments
 
LVL 1

Accepted Solution

by:
tser earned 50 total points
ID: 1302517
Try calling the main frame window's member function:
MoveWindow() or SetWindowPos()

You may have to take consideration on the border width of the frame window.
0
 

Expert Comment

by:mueller
ID: 1302518
First obtain a pointer to the child's parent window before attempting to manipulate its size.  Then resize that window as necessary.  If you need to calculate the dimensions of the child window and set the dimensions of the parent window to that, use GetWindowRect() for the child window and set accordingly for the parent.  Here is an example:

// obtain a pointer to the child's parent window
CWnd *pWndParent = GetParent();

// now get size of the current child window (including borders)
CRect rcChildRect;
GetWindowRect( &rcChildRect );

// next set the size of the parent window to that of the child
// NOTE:  the TRUE parameter forces a redraw on the parent
// window
pWndParent->MoveWindow( &rcChildRect, TRUE );

// finally update the parent window
pWndParent->UpdateWindow();


0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 135
not able to insert into temp table 68 162
Whole sheet autoscrub still needed 19 50
how to split multiple lines delimiter : 8 97
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: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

785 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