myviewbar.cpp

来自「本程序源码是为日本一家地震监测机构编写的」· C++ 代码 · 共 83 行

CPP
83
字号
// mybar.cpp : implementation file
//

#include "stdafx.h"
#include "CQuakeDemo.h"

#include "myviewbar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyViewBar

CMyViewBar::CMyViewBar()
{
	m_pInterface = NULL;
}

CMyViewBar::~CMyViewBar()
{
}


BEGIN_MESSAGE_MAP(CMyViewBar, baseCMyBar)
    //{{AFX_MSG_MAP(CMyViewBar)
    ON_WM_CREATE()
    ON_WM_SIZE()
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_INIINTERFACE,OnIniInterface)
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CMyViewBar message handlers

int CMyViewBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
    if (baseCMyBar::OnCreate(lpCreateStruct) == -1)
        return -1;

	m_TabCtrl.Create(TCS_DOWN|WS_CHILD|WS_VISIBLE,CRect(0,0,100,100),this,126);
	///将树型控件加入到TabCtrl中
	m_PageOne.Create(IDD_DLG_PAGE_ONE,&m_TabCtrl);
	m_PageTwo.Create(IDD_DLG_PAGE_TWO,&m_TabCtrl);
	CString str1, str2;
	str1.LoadString(IDS_STRING_PAGEONE_TITLE);
	str2.LoadString(IDS_STRING_PAGETWO_TITLE);
	m_TabCtrl.AddPage(&m_PageOne,str1,IDI_ICON15);
	m_TabCtrl.AddPage(&m_PageTwo,str2,IDI_ICON14);
	m_TabCtrl.UpdateWindow();
    // older versions of Windows* (NT 3.51 for instance)
    // fail with DEFAULT_GUI_FONT
    return 0;
}

void CMyViewBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
{
	baseCMyBar::OnUpdateCmdUI(pTarget, bDisableIfNoHndler);
	UpdateDialogControls(pTarget, bDisableIfNoHndler);
}

void CMyViewBar::OnSize(UINT nType, int cx, int cy) 
{
    baseCMyBar::OnSize(nType, cx, cy);
	CRect rc;
    GetClientRect(rc);
	m_TabCtrl.MoveWindow(rc);
}

LRESULT CMyViewBar::OnIniInterface(LPARAM lParam, WPARAM wParam)
{
	m_pInterface = (CControlInterface*)lParam;
	m_PageOne.m_pInterface = m_pInterface;
	m_PageTwo.m_pInterface = m_pInterface;

	m_pInterface->SetPageOnePointer(&m_PageOne);
	m_pInterface->SetPageTwoPointer(&m_PageTwo);
	return NULL;
}

⌨️ 快捷键说明

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