另外一种实现平面工具栏方法.docxVIP

  • 1
  • 0
  • 约2.19万字
  • 约 15页
  • 2018-07-24 发布于福建
  • 举报
另外一种实现平面工具栏方法

另外一种实现平面工具栏的方法(不需要MSIE)  在前面的文章“如何编写类似于Word97的工具栏”中,已经看到了一种实现平面工具栏的方法。事实上,它需要你的机器上要装有 MSIE (或comctl32.dll),这似乎有些不便。所以我自己开发出了我自己版本的平面工具栏,而不需要上面的要求。我把它称为类CToolBarEx。 使用 CToolBarEx,你可以在平面和传统方式间进行切换。更新是非常快的。 其中有些代码你可能觉得很眼熟。其实分隔线和 gripper 的绘制代码或多或少是从Roger的代码中继承来的。我为什么要做那些重复的工作。;-) 在平面模式下,由 CToolBarEx 来负责所有的绘制工作; 在传统的模式下,由 MFC 来完成工作。 由于 VC++ 4.2 及以后的版本提供了用户自绘能力,我们可以通过一局部辅助类在平面模式中来模仿该特性,所以我们可以在忽略当前模式(平面或传统)的情况下使用该特性。如果你想进一步了解用户自绘制的实现,可参见ToolBarEx.cpp文件。 CToolBarEx 包含有两个文件: ToolBarEx.h /////////////////////////////////////////////////////////////////////////////// Copyright (C) 1997 by Joerg Koenig// All rights reserved//// Distribute freely, except: dont remove my name from the source or// documentation (dont take credit for my work), mark your changes (dont// get me blamed for your possible bugs), dont alter or remove this// notice.// No warrantee of any kind, express or implied, is included with this// software; use at your own risk, responsibility for damages (if any) to// anyone resulting from the use of this software rests entirely with the// user.//// Send bug reports, bug fixes, enhancements, requests, flames, etc., and// Ill try to keep a version up to date. I can be reached as follows:// J.Koenig@adg.de (company site)// Joerg.Koenig@rhein-neckar.de (private site)/////////////////////////////////////////////////////////////////////////////#if !defined(AFX_TOOLBAREX_H__1E0F37F5_4020_11D1_9FB1_444553540000__INCLUDED_)#define AFX_TOOLBAREX_H__1E0F37F5_4020_11D1_9FB1_444553540000__INCLUDED_#if _MSC_VER = 1000#pragma once#endif // _MSC_VER = 1000// ToolBarEx.h : header file///////////////////////////////////////////////////////////////////////////////// CToolBarEx windowclass CToolBarEx : public CToolBar{ DECLARE_DYNAMIC(CToolBarEx)// data membersprivate: BOOL m_bFlatLook; CSize m_sizeOffset; // real starting point of the image COLORREF m_clrBtnFace; COLORREF m_clrBtnHilight; COLORREF m_clrBtnS

文档评论(0)

1亿VIP精品文档

相关文档