📄 workspacebar.cpp
字号:
// WorkSpaceBar.cpp : implementation file///////////////////////////////////////////////////////////////////////////////#include "StdAfx.h"#include "Resource.h"#include "WorkSpaceBar.h"#include "MainFrm.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CWorkSpaceBarCWorkSpaceBar::CWorkSpaceBar(){ NONCLIENTMETRICS ncm; memset(&ncm, 0, sizeof(NONCLIENTMETRICS)); ncm.cbSize = sizeof(NONCLIENTMETRICS); VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)); m_Font.CreateFontIndirect(&ncm.lfMessageFont);}CWorkSpaceBar::~CWorkSpaceBar(){ // TODO: add destruction code here.}IMPLEMENT_DYNAMIC(CWorkSpaceBar, CCJControlBar)BEGIN_MESSAGE_MAP(CWorkSpaceBar, CCJControlBar) //{{AFX_MSG_MAP(CWorkSpaceBar) ON_WM_CREATE() ON_WM_SIZE() ON_MESSAGE(XTWM_OUTBAR_NOTIFY,OnOutbarNotify) //}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CWorkSpaceBar message handlersint CWorkSpaceBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CCJControlBar::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndPager.Create(WS_CHILD|WS_VISIBLE|PGS_VERT, CRect(0,0,0,0), this, IDC_PAGER_CTRL)) { TRACE0("Failed to create CPagerCtrl...\n"); return -1; } // Create the OutlookBar control using m_wndPager as the parent. if (!m_wndOutlookBar.Create( WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(0,0,0,0), &m_wndPager,IDC_OUTLOOKBAR)) { TRACE0("Failed to create COutlookBar...\n"); return -1; } // Set the CWnd object you want messages sent to. m_wndOutlookBar.SetOwner(this); m_wndOutlookBar.SetColors(RGB(0xff,0xff,0xff), RGB(0x3a,0x6e,0xa5)); // Add items to the Outlook Bar control. m_wndOutlookBar.AddMenuItem(IDR_MAINFRAME,_T("数据显示")), m_wndOutlookBar.AddMenuItem(IDI_SEARCH,_T("查询与统计")), m_wndPager.SetChild(m_wndOutlookBar.GetSafeHwnd()); m_wndPager.SetButtonSize(15); return 0;}void CWorkSpaceBar::OnSize(UINT nType, int cx, int cy) { CCJControlBar::OnSize(nType, cx, cy); if(m_wndPager.GetSafeHwnd()) { m_wndPager.MoveWindow(0,17,cx,cy); }}void CWorkSpaceBar::OnOutbarNotify(UINT lParam, LONG wParam){ this->m_pMainFrame=(CMainFrame*)::AfxGetApp()->m_pMainWnd; switch(wParam) // control id. { case IDC_OUTLOOKBAR: { // Get the menu item. XT_CONTENT_ITEM* pContentItems=m_wndOutlookBar.GetMenuItem((int)lParam); ASSERT(pContentItems); m_pMainFrame->ChangeView(lParam);
m_pMainFrame->ChangeOutputView(lParam); } break; default: break; }
::AfxGetApp()->m_pMainWnd->SetWindowText("学生信息管理系统");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -