首页 | 好库网 | 论坛 | 文章 | 代码
主      题: 如何让多文档试图程序的视图最大化?
作      者: 编之呆
回复次数: 2
发表时间: 2006-12-27 10:43:12
正文内容: 无

回复人: HYJ2006-12-27 10:45:37
ShowWindow(SW_MAXIMIZE);


回复人: YangTze (得分:10)2006-12-27 10:46:41
Re:如何让多文档试图程序的视图最大化?
Knowledge Base  

HOWTO: How to Create a Minimized/Maximized MDI Child Window

PSS ID Number: Q142317

Article Last Modified on 08-16-2001


--------------------------------------------------------------------------------
The information in this article applies to:

The Microsoft Foundation Classes (MFC)
Microsoft Visual C++ for Windows, 16-bit edition 1.0, 1.5, 1.51, 1.52
Microsoft Visual C++, 32-bit Editions 1.0, 2.0, 2.1, 2.2, 4.0

--------------------------------------------------------------------------------


Summary
To create an initially minimized or maximized document in an MDI application, derive a class from CMDIChildWnd and override ActivateFrame(). In the ActivateFrame() member function, call the ActivateFrame() function in the base class, and pass SW_SHOWMINIMIZED or SW_SHOWMAXIMIZED as the parameter.



More Information
If you're using a version of Visual C++ earlier than 4.0, it is necessary to derive a class from CMDIChildWnd and substitute the new class name in the CMultiDocTemplate used in your CWinApp-derived InitInstance() function. To do so, use ClassWizard to add a class called CChildFrame derived from CMDIChildWnd. Include the header file in your application's .cpp file. Then change the line indicated below in your InitInstance() function:

    CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(
        IDR_MDIAPPTYPE,
        RUNTIME_CLASS(CMDIAppDoc),
        RUNTIME_CLASS(CChildFrame), // change CMDIChildWnd to CChildFrame
        RUNTIME_CLASS(CMDIAppView));
    AddDocTemplate(pDocTemplate);
In Visual C++ 4.0, deriving a class from CMDIChildWnd is not required because one is already provided for you.

In the CChildFrame class, override the ActivateFrame() member function as follows:
void CChildFrame::ActivateFrame(int nCmdShow)
{
    if (nCmdShow == -1)
        nCmdShow = SW_SHOWMAXIMIZED;

    CMDIChildWnd::ActivateFrame(nCmdShow);
}

Additional query words: kbinf 1.00 2.00 2.10 2.20 4.00 1.50 PreCreateWindow CREATESTRUCT CChildFrame Maximized WS_MAXIMIZE Cs.style

Keywords: kbDocView kbMFC KbUIDesign kbVC kbGrpDSMFCATL
Issue Type: kbhowto
Technology: kbAudDeveloper kbMFC



--------------------------------------------------------------------------------

Send feedback to Microsoft

© 2002-2003 Microsoft Corporation. All rights reserved.