VC++实现工具栏上添加平面组合框控件(5)
rcItem.top -= 1;
rcItem.bottom += 1;
rcItem.OffsetRect(1,1);
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNSHADOW),::GetSysColor(COLOR_BTNHIGHLIGHT));
break;
}
ReleaseDC(pDC);
}
int CFlatComboBox::Offset()
{
// Thanks to Todd Brannam for this suggestion...
return ::GetSystemMetrics(SM_CXHTHUMB);
}
/////////////////// MainToolBar.h: interface for the CMainToolBar class.
#if !defined(AFX_MAINTOOLBAR_H__76CF28F4_005F_11D7_8F58_00E04C0BECE6__INCLUDED_)
#define AFX_MAINTOOLBAR_H__76CF28F4_005F_11D7_8F58_00E04C0BECE6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "FlatComboBox.h"
class CMainToolBar : public CToolBar
{
public:
CMainToolBar();
virtual ~CMainToolBar();
public:
CFlatComboBox m_wndZoom;
};
#endif
////////////////////////////// MainToolBar.cpp: implementation of the CMainToolBar class.
#include "stdafx.h"
#include "ToolBar.h"
#include "MainToolBar.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CMainToolBar::CMainToolBar()
{}
CMainToolBar::~CMainToolBar()
{}
//////////////////////////////////////////////////////////////////////////////////////////////
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
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))
{