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

📄 combotoolbar.cpp

📁 精通MFC程序设计
💻 CPP
字号:
// ComboToolBar.cpp : implementation file
//

#include "stdafx.h"
#include "CToobarDemo.h"
#include "ComboToolBar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CComboToolBar

CComboToolBar::CComboToolBar()
{
}

CComboToolBar::~CComboToolBar()
{
}

BOOL CComboToolBar::CreateCombo( DWORD dwStyle, CComboBox *pComboBox, UINT nID,
							 int nWidth, int nHeight )
{
	// set the size of combo-control
	CRect pRect(-nWidth, -nHeight, 0, 0);
	pRect.right -= 2;

	// make the button, that is selected to be the combo-control,
	// a separator and resize that separator
	ASSERT(CommandToIndex(nID) >= 0); // make sure the id is valid
	SetButtonInfo( CommandToIndex( nID ), nID, TBBS_SEPARATOR, nWidth );

	// create the combo-control itself, reposition it in the
	// client-area and show it
	if (!pComboBox->Create( dwStyle, pRect, this, nID ))
	{
		  TRACE("Failed to create the combo-box %p .\n", nID);
		  return FALSE;
	}

	GetItemRect( CommandToIndex(nID), &pRect );

	pRect.left += 2;
	pRect.right = pRect.left + nWidth;

	pComboBox->SetWindowPos(0, pRect.left, pRect.top, 0, 0,
		SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS );

//	pComboBox->SetFont( &m_GuiFont );
	pComboBox->ShowWindow( SW_SHOW );
	
	return TRUE;
}
BEGIN_MESSAGE_MAP(CComboToolBar, CToolBar)
	//{{AFX_MSG_MAP(CComboToolBar)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CComboToolBar message handlers

⌨️ 快捷键说明

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