Resize a form at runtime in MFC

Posted on 2003-03-27
Medium Priority
Last Modified: 2006-11-17
What is the best way to resize a form at runtime using MFC?
Basically what I need to do is when a button is pressed the action will be mapped to a meathod that will adjust the width of the form.  This is a single dialog application.  Thanks in advance for all the help

Question by:fastawdtsi
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
  • 2
LVL 48

Accepted Solution

AlexFM earned 380 total points
ID: 8217422
Use MoveWindow function.

void CMyDialog::OnResizeButtonPressed()
    CRect rect;
    GetWindowRect(&rect);   // screen coordinates
    // convert to parent coordinates if necessary
    if ( GetParent() )

    // checge rect.right, rect.bottom as needed

LVL 48

Expert Comment

ID: 8217433
Did you unserstand the word "checge"? It's "change" :-)

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

764 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