Click here to Skip to main content
Click here to Skip to main content

A raw toolbar for Dialog and Property page with plenty nice styles (version 1.01)

By , 23 Aug 2006
Rate this:
Please Sign up or sign in to vote.

Download source program (version 1.01)

Update information

Only new features and bug-fixed are displayed bellow.
Please visit previous version 1.00 for more information.
 

  • FunctionCreate() function has been changed to:
    BOOL Create(CWnd*pMum,int iBmpID,int cx,int iBarID=-1,COLORREF clrBkgnd=RGB(192,192,192));
    In version 1.00, the function is:
    BOOL Create(CWnd*pMum,int iBmpID,int cx,int iBarID=-1);
      
    clrBkgnd : transparent color of bitmap resource, similar to the color in CImageList
     
    I developed 1.00 on Win98, but when I tested on XP, I found the problem: bitmap background is not transparent to COLOR_BTNFACE, this parameter allows to fit the color to COLOR_BTNFACE - automatically done by CImageList.
     
  • MessagesA new message is added to the toolbar: 
    If user right clicks a button, the new message is distribute to parent window.
     
    To process multiple messages in parent widow, a message class has to be used.
    Message signature is:
    message: WM_COMMAND, wParam: toolbar's ID (same as in version 1.00).
    lParam: a pointer to class ToolbarMine::Message.
     
    The inner message class contains following members:
    class Message
    {
    public:
    UINT  uMessage; //see bellow
    int iIndex; //index of the button clicked
    CRect rcButton //rectangle of the button clicked 
    };
     
    uMessage has 2 cases:
     
    1. WM_LBUTTONDOWN
      It is the same as the only message in version 1.00.
      Please note: 
      The message is actually distributed at WM_LBUTTONUP for independent buttons.
      It is almost unnecessary to define new message constant, so I simply use this existing Windows constant.
      This is similar to Windows' common buttons, which tell us a button is clicked rather than down or up.
       
    2. WM_RBUTTONDOWN
      The message is distributed when user clicks a button by right-button of mouse.
      Right-clicking a button does not change button situations (checked or pressed) at all.
       
      The message allows us to do some interesting things with it.
      In my application (not sample program), I display a popup menu associated with the message, which contains "Help", "Edit", "Submit" and "Close" menu items, so my application can offer more options with a button.
       
    Please check source program for more.

7 interfaces on XP with different toolbar styles

(Every interface displays 14 toolbars which represent 14 button styles).

1. Toolbar style: NONE

2. Toolbar style: RAISED

3. Toolbar style: STRONG RAISED

4. Toolbar style: SUNKEN

5. Toolbar style: STRONG SUNKEN

6. Toolbar style: COLORED

7. Toolbar style: STRONG COLORED

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

includeh10
Web Developer
Australia Australia

Please visit our Download Home to obtain many interesting software for free ...



Comments and Discussions

 
GeneralCode will not compile with VS2005 PinmemberDevaRoo20-Dec-06 10:02 
QuestionDo you have any idea how can I have on mouse over image? Pinmemberthruthesky28-Oct-06 12:49 
QuestionIs it okay to hold 24x24 bmp images? Pinmemberthruthesky28-Oct-06 2:43 

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.

| Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 23 Aug 2006
Article Copyright 2006 by includeh10
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid