CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 1999
    Posts
    12

    CFormView -- Dialog resize?

    I created an MFC application which is derived from CFormView -- so there is a main dialog insize of a frame.

    My Question: How do I resize the dialog in response to the MainFrame being sized? I know I have to override the ON_SIZE handler from the MainFrame class.. BUT -- how do I get a handle to the dialog inside of that frame so that I can MoveWindow on it?


  2. #2
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266

    Re: CFormView -- Dialog resize?

    Instead of overriding OnSize in your MainFrame, override it in your view.

    If it were me, I would use CView instead of CFormView if I want to dynamically resize the form. The problem with CFormView is that you probably need to write logic to determine where the controls are at, then write logic to dynamically resize. With CView, you can write logic to initially size everything and the same logic can be used to resize it. The disadvantage of CView is that you must write the logic to initially create the controls. The details of what you do and how you do it depends very much on what you want to do and how you want to do it.

    In my program that dynamically resizes the form, my override of CView::OnSize includes the following:

    RECT ClientRect;
    CView::OnSize(nType, cx, cy);
    if (nType != SIZE_RESTORED && nType != SIZE_MAXIMIZED)
    return;
    GetClientRect(&ClientRect);





    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured