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

📄 wzdtlbar.cpp

📁 Visual C++高级界面特效制作百例 本书通过100个实例全面讲述了应用Visual C++的MFC进行高级界面编程的思想。书中均以一个实例的详细实现步骤为引子
💻 CPP
字号:
// WzdTlBar.cpp : implementation file
//

#include "stdafx.h"
#include "wzd.h"
#include "WzdTlBar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CWzdToolBar

CWzdToolBar::CWzdToolBar()
{
}

CWzdToolBar::~CWzdToolBar()
{
}


BEGIN_MESSAGE_MAP(CWzdToolBar, CToolBar)
	//{{AFX_MSG_MAP(CWzdToolBar)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWzdToolBar message handlers

BOOL CWzdToolBar::LoadToolBarEx(UINT id)
{
	// load toolbar info
	BOOL bRet;
	if (bRet=CToolBar::LoadToolBar(id))
	{
		// make flat buttons
		ModifyStyle(0, TBSTYLE_FLAT);
	}

	return bRet;
}



void CWzdToolBar::OnPaint() 
{
	CToolBar::OnPaint();

	// if floating, no grabber bar
	if (IsFloating())
		return;

	// draw to whole window!
	CWindowDC dc(this);

	// draw horizontal or vertical grabber bar
	CRect rect;
	GetClientRect(&rect);

	CPen penHL(PS_SOLID,2,::GetSysColor(COLOR_3DHIGHLIGHT));
	CPen penSH(PS_SOLID,3,::GetSysColor(COLOR_3DSHADOW));

	CPen *pPen=dc.SelectObject(&penSH);
	if (GetBarStyle()&CBRS_ORIENT_HORZ)
	{
		// draw shadow lines
		rect.OffsetRect(4,4);
		dc.MoveTo(rect.left,rect.top);
		dc.LineTo(rect.left,rect.bottom);
		dc.MoveTo(rect.left+4,rect.top);
		dc.LineTo(rect.left+4,rect.bottom);

		// draw highlight lines
		dc.SelectObject(&penHL);
		dc.MoveTo(rect.left,rect.top);
		dc.LineTo(rect.left,rect.bottom-1);
		dc.MoveTo(rect.left+4,rect.top);
		dc.LineTo(rect.left+4,rect.bottom-1);
	}
	else
	{
		// draw shadow lines
		rect.OffsetRect(4,2);
		dc.MoveTo(rect.left,rect.top);
		dc.LineTo(rect.right,rect.top);
		dc.MoveTo(rect.left,rect.top+4);
		dc.LineTo(rect.right,rect.top+4);

		// draw highlight lines
		dc.SelectObject(&penHL);
		dc.MoveTo(rect.left,rect.top);
		dc.LineTo(rect.right-1,rect.top);
		dc.MoveTo(rect.left,rect.top+4);
		dc.LineTo(rect.right-1,rect.top+4);
	}

	dc.SelectObject(pPen);
}

⌨️ 快捷键说明

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