Click here to Skip to main content
Licence 
First Posted 3 Dec 2001
Views 164,258
Bookmarked 64 times

A ToolBarCtrl Based Menubar Control

By | 3 Dec 2001 | Article
A ToolBarCtrl based menubar control using CMenuXP

Sample Image - MenuBarXP.jpg

Introduction

This menubar control is based on the CToolBarCtrl class rather than CToolBar, so it never assumes that it has a parent window derived from CFrameWnd. It lacks some features like docking or automatic tooltips, but it can be used with any window whose parent is derived from CWnd. You must of course be using MFC.

Implementation

Between CMenuBar and CToolBarCtrl, I wrote a class named CToolBarXP to process customdraw. If you don't need this feature, just modify the base class as CToolBarCtrl, and remove the following line from the messagemap:

	ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, CToolBarXP::OnCustomDraw)

CToolBarXP includes a LoadToolBar member function to load a toolbar resource. It may be useful to you, even if you don't care about menubars or customdraw.

CMenuXP is used as the menu class to implement ownerdraw. CMenuXP is derived from CMenu so it has all the features of CMenu. If you don't need a ownerdraw menu, just use the CMenu members to construct the menu.

The included sample is simple and far from powerful, but it is a good start I hope.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Neil Yao



China China

Member

I'm a chinese programer living in Shanghai, currently working for a software company whose main business is to deliver computer based testing. Software simulation for computer based testing and certifications is my main responsibility in this company. Execpt for software development, I like out-door activities and photography. I am willing to make friends in China and all over the world, so contact me if you have anything in common with meSmile | :)

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalctoolbarxp didn't display text Pinmemberwanglinhai88820:16 21 Feb '10  
GeneralSubMenu Bug Pinmemberbenjamin234:39 21 May '08  
GeneralApp suddenly exits PinmemberChris98218:59 21 Apr '08  
GeneralRe: App suddenly exits Pinmemberhujian_19819:39 27 Sep '09  
QuestionSEPARATOR bug Pinmemberlihe200520:16 7 Sep '06  
GeneralSome improvement (XP themes) PinmemberAlexXF7:29 24 Nov '04  
GeneralRe: Some improvement (XP themes) PinmemberFrank Overcast15:40 22 Jan '06  
GeneralCatch Click Events Pinmembernaumankhan21:44 15 Apr '04  
GeneralRe: Catch Click Events PinmemberYao Zhifeng21:59 15 Apr '04  
GeneralRe: Catch Click Events Pinmemberjagan_gadela1:33 21 Apr '04  
GeneralRe: Catch Click Events Pinmemberjagan_gadela1:58 21 Apr '04  
GeneralRe: Catch Click Events PinmemberYao Zhifeng4:10 21 Apr '04  
GeneralRe: Catch Click Events Pinmemberjagan_gadela2:05 22 Apr '04  
GeneralRe: Catch Click Events PinmemberYao Zhifeng23:12 22 Apr '04  
GeneralRe: Catch Click Events PinmemberJim Tomasko22:38 24 Apr '04  
Questionpossible to use this on SDI??? PinmemberHirosh20:57 16 Feb '03  
GeneralPretty cool, only one thing though PinmemberAnonymous0:50 11 May '02  
Questionhow to change the color of the toolbar? PinmemberAnonymous19:40 1 May '02  
GeneralI have a problem!!! PinmemberCSZX0:48 3 Apr '02  
GeneralDoesn't work with dropdown arrow. PinmemberDuc Truong14:23 14 Jan '02  
GeneralChanging background color of Menu PinmemberRitesh2322:36 21 Dec '01  
GeneralGood job PinmemberCool_worm1:37 19 Dec '01  
GeneralMenu icon lost itself when mousemove on the popup menu items PinmemberGolden Lee15:46 10 Dec '01  
GeneralGetParent Pinmemberorcun colak17:44 6 Dec '01  
GeneralRe: GetParent PinmemberYao Zhifeng4:13 7 Dec '01  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 4 Dec 2001
Article Copyright 2001 by Neil Yao
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid