Thread: Resize Dialog Box via Code :: MFC

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    Resize Dialog Box via Code :: MFC

    Hi.

    I would like to know is it possible and how to internally (program) resize a dialog box. For example:

    Code:
    ---------------------
    |                       |
    |edit box           |
    |button             |
    |                       |
    ---------------------
    Given a dialog box with that looks like the one above, I would like to programmably resize it.

    Code:
    --------------------
    |                      |
    |edit box          |
    |button            |
    |                      |
    |                      |
    |                      |
    |                      |
    --------------------
    In other words, I would like to expand and contracts the dialog frame.

    Thanks,
    Kuphryn
    Last edited by kuphryn; 10-25-2002 at 01:24 PM.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I create them from scratch based on the PC's screen resolution using CreateWindow (Ex).

    If you are using a dialog template you will need to

    find all the controls (children on dialog)
    get size of child
    calc the new dimensions
    SetWindowPos() to change the sizes

    I would, depending on the dialogs complexity, kill it and start again.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Okay. Thanks.

    monrobot13 posted on Code Project this link. The
    solution works great.

    http://www.codeproject.com/dialog/dlgboxtricks.asp

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dialog Box from within a dll without MFC
    By tonyxxy in forum C++ Programming
    Replies: 9
    Last Post: 01-31-2009, 07:49 PM
  2. Display Dialog Box Then Execute
    By stickman in forum C++ Programming
    Replies: 17
    Last Post: 05-10-2006, 11:02 AM
  3. Dialog box determined to close!!!
    By mhandlon in forum Windows Programming
    Replies: 1
    Last Post: 01-18-2006, 09:33 AM
  4. Drawing in a dialog box with MFC
    By Gravedigga in forum Windows Programming
    Replies: 3
    Last Post: 01-03-2004, 11:01 PM
  5. CListBox & Dialog Box :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 06-05-2002, 01:51 PM