⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.cpp

📁 These listed libraries are written in WTL. But it s really hard to mix both MFC & WTL together. Obvi
💻 CPP
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "resource.h"
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define CONTROLBAR_PROFILE _T("ControlBar")

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNAMIC(CMainFrame, CTabbedMDIFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CTabbedMDIFrameWnd)
	ON_WM_CREATE()
	ON_WM_CLOSE()
	ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_MYBAR01, ID_VIEW_MYBAR03, OnUpdateControlBarMenu)
	ON_COMMAND_EX_RANGE(ID_VIEW_MYBAR01, ID_VIEW_MYBAR03, OnBarCheck)
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
}

CMainFrame::~CMainFrame()
{
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CTabbedMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	//////////////////////////////////////////////////////////////////////////
	// Create tabbed control bars
	m_wndMyBar1.Create(this, _T("MyBar 01"), ID_VIEW_MYBAR01, CSize(200, 100));
	m_wndMyBar2.Create(this, _T("MyBar 02"), ID_VIEW_MYBAR02, CSize(200, 100));
	m_wndMyBar3.Create(this, _T("MyBar 03"), ID_VIEW_MYBAR03, CSize(200, 100));

	m_wndMyBar1.SetIcon(LoadIcon(NULL, MAKEINTRESOURCE(IDI_INFORMATION)), FALSE);
	m_wndMyBar2.SetIcon(LoadIcon(NULL, MAKEINTRESOURCE(IDI_ERROR)), FALSE);
	m_wndMyBar3.SetIcon(LoadIcon(NULL, MAKEINTRESOURCE(IDI_WARNING)), FALSE);

	m_wndMyBar1.DockToParentFrame(CDockingControlBar::DockingSide::sLeft);
	m_wndMyBar2.DockTo(&m_wndMyBar1);
	m_wndMyBar3.DockTo(&m_wndMyBar1);

	// End
	//////////////////////////////////////////////////////////////////////////

	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

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

	// Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	//////////////////////////////////////////////////////////////////////////
	// Restore latest layout
	this->LoadBarState(CONTROLBAR_PROFILE);

	return 0;
}

void CMainFrame::OnClose()
{
	//////////////////////////////////////////////////////////////////////////
	// Store layout
	this->SaveBarState(CONTROLBAR_PROFILE);

	CTabbedMDIFrameWnd::OnClose();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -