在框架窗口中创建属性表

时间:2014-01-02 11:03:58

标签: visual-c++ mfc

我正在使用MDI应用程序。我想在框架窗口区域内创建一个属性表,如下图中的箭头所示:

MDI Application

我见过一些示例,我们可以在创建属性表之后使用ShowWindow()函数,但是它会创建未嵌入到框架窗口中的属性表。

我们可以像在静态框等其他控件一样在框架窗口上创建属性表吗?

2 个答案:

答案 0 :(得分:0)

如果您需要在视图中嵌入可调整大小的属性表,请查看BCGSoft大小(http://www.bcgsoft.com) - 版本中的最新BCGControlBar显示了如何执行此操作:

http://www.bcgsoft.com/images/resizableform220.jpg

如果您只需要一个选项卡式MDI窗口,只需在MFC应用程序向导(VS 2008或更高版本)中创建一个类似Visual Studio的应用程序。

希望,这有帮助。

罗布

答案 1 :(得分:0)

添加CMultiDocTemplate个实例解决了我的问题。这是代码片段。这是ProjectName.cpp文件的一部分:

BOOL CEmuDiagnosticsClientApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles.  Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);

CWinAppEx::InitInstance();

// Initialize OLE libraries
if (!AfxOleInit())
{
    AfxMessageBox(IDP_OLE_INIT_FAILED);
    return FALSE;
}
AfxEnableControlContainer();

//Added new code
{
    CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(IDR_STRING_LOGGINGWINDOW,
        RUNTIME_CLASS(CEmuDiagnosticsClientDoc),
        RUNTIME_CLASS(CChildFrame), // custom MDI child frame
        RUNTIME_CLASS(CLoggingWindow));
    if (!pDocTemplate)
        return FALSE;
    AddDocTemplate(pDocTemplate);
}
//End: Added new code

// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)

InitContextMenuManager();

InitKeyboardManager();

InitTooltipManager();
CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = TRUE;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
    RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

// Register the application's document templates.  Document templates
//  serve as the connection between documents, frame windows and views
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_STRING_SIGNALWINDOW,
    RUNTIME_CLASS(CEmuDiagnosticsClientDoc),
    RUNTIME_CLASS(CChildFrame), // custom MDI child frame
    RUNTIME_CLASS(CSignalWindow)); //Changed Code
if (!pDocTemplate)
    return FALSE;
AddDocTemplate(pDocTemplate);


// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
{
    delete pMainFrame;
    return FALSE;
}
m_pMainWnd = pMainFrame;
// call DragAcceptFiles only if there's a suffix
//  In an MDI app, this should occur immediately after setting m_pMainWnd


// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

// Dispatch commands specified on the command line.  Will return FALSE if
// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
if (!ProcessShellCommand(cmdInfo))
    return FALSE;
// The main window has been initialized, so show and update it
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();

return TRUE;
}

//添加新代码部分中,创建了一个新的CMultiDocTemplate实例。 CLoggingWindow是我想在框架窗口中显示的类 另一个班级CSignalWindow我还希望显示在 //已更改代码区域中修改的内容。

要记住的事情:
您要显示的-Dialog必须来自CFormView,而不是CDialog - 更改对话框属性:边框 - >无风格 - >儿童所有其他属性为false。