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

Resize a form at runtime in MFC

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

Ernie
0
fastawdtsi
Asked:
fastawdtsi
  • 2
1 Solution
 
AlexFMCommented:
Use MoveWindow function.

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

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

    MoveWindow(&rect);
}
0
 
AlexFMCommented:
Did you unserstand the word "checge"? It's "change" :-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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