コード例 #1
0
ファイル: MainFrm.cpp プロジェクト: dalinhuang/demodemo
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
		return -1;

	BOOL bNameValid;
	// 基于持久值设置视觉管理器和样式
	OnApplicationLook(theApp.m_nAppLook);

	m_wndRibbonBar.Create(this);
	InitializeRibbon();

	if (!m_wndStatusBar.Create(this))
	{
		TRACE0("未能创建状态栏\n");
		return -1;      // 未能创建
	}

	CString strTitlePane1;
	CString strTitlePane2;
	bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1);
	ASSERT(bNameValid);
	bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2);
	ASSERT(bNameValid);
	m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1);
	m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2);

	// 启用 Visual Studio 2005 样式停靠窗口行为
	CDockingManager::SetDockingMode(DT_SMART);
	// 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为
	EnableAutoHidePanes(CBRS_ALIGN_ANY);

	// 加载菜单项图像(不在任何标准工具栏上):
	CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0);

	// 创建停靠窗口
	if (!CreateDockingWindows())
	{
		TRACE0("未能创建停靠窗口\n");
		return -1;
	}

	m_wndCameraView.EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndCameraView);

	m_wndWarningView.EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndWarningView);

	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),TRUE);

	return 0;
}
コード例 #2
0
ファイル: MainFrm.cpp プロジェクト: keptons/CryptCube
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{

	CMainFrame b;
	ShowWindow(SW_HIDE);//隐藏主窗口 
	//b.DoModal();把登录窗口显示处理 
	if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
		return -1;
	//
	// 设置用于绘制所有用户界面元素的视觉管理器
	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007));

	m_wndRibbonBar.Create(this);
	InitializeRibbon();

	if (!m_wndStatusBar.CreateEx(this,0,WS_CHILD|WS_VISIBLE|CBRS_BOTTOM,AFX_IDW_STATUS_BAR))
	{
		TRACE0("未能创建状态栏\n");
		return -1;      // 未能创建
	}

	BOOL bNameValid;
	CString strTitlePane1;
	CString strTitlePane2;
	bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1);
	ASSERT(bNameValid);
	bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2);
	ASSERT(bNameValid);
	m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1);
	m_wndStatusBar.RemoveElement(NULL);
	//m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2);
	

	m_wndStatusBar.SetInformation(_T(" "));

	return 0;
}
コード例 #3
0
ファイル: MainFrm2.cpp プロジェクト: dehilsterlexis/eclide
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
        return -1;

    m_wndClientArea.ModifyStyleEx(WS_EX_CLIENTEDGE, 0);

    // create a view to occupy the client area of the frame
    //if (!m_wndView.Create(IDD_ABOUTBOX, this))
    //m_wndView.Create(GetSafeHwnd(), CRect(10,300,100,330), _T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, NULL, 2);
    //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    //{
    //	TRACE0("Failed to create view window\n");
    //	return -1;
    //}
    // set the visual manager and style based on persisted value
    OnApplicationLook(theApp.m_nAppLook);

    //// create a view to occupy the client area of the frame
    //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    //{
    //	TRACE0("Failed to create view window\n");
    //	return -1;
    //}

    boost::filesystem::path iniPath;
    GetIniPath(iniPath);
    CComPtr<IConfig> ini = CreateIConfig(AMT_INI, iniPath);
    CString config1( ini->Get(g_szConfigSection, RepLabel1, _T("0")) );
    CString config2( ini->Get(g_szConfigSection, RepLabel2, _T("1")) );

    m_splitter.Create(m_hWndMDIClient, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

    m_repositoryDlg.Create(m_splitter);

    //m_detailSheetView.SetReflectNotifications(true);
    m_detailSheetView.SetTabStyles(CTCS_BOTTOM | CTCS_TOOLTIPS);
    m_detailSheetView.Create(m_splitter, ATL::CWindow::rcDefault);
    //m_detailView.SetFont(WTL::AtlGetDefaultGuiFont());

    m_sourceEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault);
    m_sourceEclView.DoInit();
    m_sourceEclView.SetReadOnly(true);
    //TODO:  InitEclCommandMixin(this, this, &m_sourceEclView, this);
    m_detailSheetView.AddTab(m_sourceEclView, _T("Source ECL"));

    m_diffView.Create(m_detailSheetView, ATL::CWindow::rcDefault, _T(""), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE);
    m_detailSheetView.AddTab(m_diffView, _T("Differences"));

    m_targetEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault);
    m_targetEclView.DoInit();
    m_targetEclView.SetReadOnly(true);
    //TODO:  InitEclCommandMixin(this, this, &m_targetEclView, this);
    m_detailSheetView.AddTab(m_targetEclView, _T("Target ECL"));

    m_dependees.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE);
    m_dependees.SetFont(WTL::AtlGetDefaultGuiFont());
    m_detailSheetView.AddTab(m_dependees, _T("Dependee Check"));

    m_logView.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | LBS_NOINTEGRALHEIGHT, WS_EX_CLIENTEDGE);
    m_logView.SetFont(WTL::AtlGetDefaultGuiFont());
    m_detailSheetView.AddTab(m_logView, _T("Log"));

    WTL::CEdit edit;
    edit.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE);

    CString face = _T("MS Shell Dlg");
    int nPointSize = 8;

    WTL::CFont font;
    WTL::CLogFont logFont;
    logFont.lfCharSet = DEFAULT_CHARSET;
    logFont.lfHeight = nPointSize*10;
    ::_tcsncpy(logFont.lfFaceName, face, LF_FACESIZE);
    logFont.lfWeight = FW_LIGHT;
    logFont.lfQuality = PROOF_QUALITY;
    logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
    logFont.lfOutPrecision = OUT_TT_PRECIS;
    if ( font.CreatePointFontIndirect(&logFont,0) )
    {
        edit.SetFont(font.Detach(),false);
    }
    m_warnView.SetEditCtrl(edit.Detach());

    m_detailSheetView.AddTab(m_warnView, _T("Warnings"));
    m_detailSheetView.GetTabCtrl().SetCurSel(1);

    m_splitter.SetSplitterPanes(m_repositoryDlg, m_detailSheetView);
    m_splitter.SetSplitterPosPct(50);

    m_wndRibbonBar.Create(this);
    InitializeRibbon();

    if (!m_wndStatusBar.Create(this))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
    }

    m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, _T(""), TRUE), _T(""));
    m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, _T(""), TRUE), _T(""));
    CMFCRibbonProgressBar * elem = new CMFCRibbonProgressBar(ID_STATUSBAR_PANE3);
    m_wndStatusBar.AddExtendedElement(elem, _T("Progress"));
    elem->SetRange(1, 1);
    elem->SetPos(0);

    // enable Visual Studio 2005 style docking window behavior
    CDockingManager::SetDockingMode(DT_SMART);
    // enable Visual Studio 2005 style docking window auto-hide behavior
    EnableAutoHidePanes(CBRS_ALIGN_ANY);

    // Enable enhanced windows management dialog
    //EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);

    HICON newIcon = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME_AMT));
    HICON oldIcon = SetIcon(newIcon, false);
    HICON oldIcon2 = SetIcon(newIcon, true);

    RecalcLayout();
    if ( !m_bStreamInit )
    {
        m_pOldBuf = std::cerr.rdbuf(&m_EditStrBuf);
        m_pOldBufW = std::wcerr.rdbuf(&m_EditStrBufW);
        m_bStreamInit = true;
    }

    PostMessage(UM_INITIALIZE);
    return 0;
}
コード例 #4
0
ファイル: MainFrm.cpp プロジェクト: killbug2004/WSProf
bool CMainFrame::CreateRibbon()
{
	m_wndRibbonBar.Create(this);
	InitializeRibbon();
	return true;
}
コード例 #5
0
ファイル: TinyCADMainFrm.cpp プロジェクト: karosLi/TinyCAD
int CTinyCADMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
		return -1;

	BOOL bNameValid;
	// 基于持久值设置视觉管理器和样式
	OnApplicationLook(theApp.m_nAppLook);

	CMDITabInfo mdiTabParams;
	mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 其他可用样式...
	mdiTabParams.m_bActiveTabCloseButton = TRUE;      // 设置为 FALSE 会将关闭按钮放置在选项卡区域的右侧
	mdiTabParams.m_bTabIcons = FALSE;    // 设置为 TRUE 将在 MDI 选项卡上启用文档图标
	mdiTabParams.m_bAutoColor = TRUE;    // 设置为 FALSE 将禁用 MDI 选项卡的自动着色
	mdiTabParams.m_bDocumentMenu = TRUE; // 在选项卡区域的右边缘启用文档菜单
	EnableMDITabbedGroups(TRUE, mdiTabParams);

	m_wndRibbonBar.Create(this);
	InitializeRibbon();

	if (!m_wndStatusBar.Create(this))
	{
		TRACE0("未能创建状态栏\n");
		return -1;      // 未能创建
	}

	CString strTitlePane1;
	CString strTitlePane2;
	bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1);
	ASSERT(bNameValid);
	bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2);
	ASSERT(bNameValid);
	m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1);
	m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2);

	// 启用 Visual Studio 2005 样式停靠窗口行为
	CDockingManager::SetDockingMode(DT_SMART);
	// 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为
	EnableAutoHidePanes(CBRS_ALIGN_ANY);

	// 加载菜单项图像(不在任何标准工具栏上):
	CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0);

	// 创建停靠窗口
	if (!CreateDockingWindows())
	{
		TRACE0("未能创建停靠窗口\n");
		return -1;
	}

	m_wndFileView.EnableDocking(CBRS_ALIGN_ANY);
	m_wndClassView.EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndFileView);
	CDockablePane* pTabbedBar = NULL;
	m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar);
	m_wndOutput.EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndOutput);
	m_wndProperties.EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndProperties);


	// 启用增强的窗口管理对话框
	EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);

	return 0;
}