CMacButton, CMacCheckBox '& CMacRadioButton


Environment: VC6, NT4 SP4,

These three classes are my attempt at recreating the standard buttons on the Macintosh. The normal appearance of the buttons duplicates the 3D look of the more recent MacOS versions, but an old-style "flat" look can also be used by setting the button's Flat style in the resource editor.

The following public function is available for CMacButton:

  • void SetBold(BOOL bBold = TRUE)
  • BOOL GetBold()

The following public functions are available for CMacCheckBox and CMacRadioButton:

  • void SetCheck(int nCheck)
  • int GetCheck()

Follow these steps to add a CMacXXX button to a dialog:

  • Add the desired files to your project.
  • Add the appropriate include to the header file of your dialog class.
  • Add checkboxes/radio buttons/standard buttons to your dialog in the resource editor.
  • Use ClassWizard to add a member variable of type CMacButton, CMacCheckBox, or CMacRadioButton for the corresponding controls you just added. If the CMacXXX classes are not in the Variable Type list, choose CButton, and manually change the types in the header file of your dialog class.

To do list:

  • Add support for bitmaps on buttons
  • Add support for horizontal and vertical alignment
  • Add support for push-like check boxes and radio buttons
  • Add support for tri-state check boxes and radio buttons


Download demo project - 34 Kb
Download source - 14 Kb


  • Jordan shoes mentioned Gene to go for the manufacturer, a disunion of Nike

    Posted by TaddyGaffic on 04/22/2013 07:12pm

    The sole of shoes are made from high quality rubber material and come with the lining. One can easily search for Vans footwear in the various online stores where they are easily available at great discount prices. These come in almost an infinite amount of [url=]nike free run[/url] color and are usually on the cheap side. Experts as well as the rights of employees in regards to the apple can annihilate the Nike Air Max For travel arrangements in developing abjection can be a acceptable accord added in comparison to they're prevention, nonetheless they do accommodate sports sports athletes while using high duke inside their profession. Bargain Nike Air Max 2009 aswell provides countless jobs inside the nations absolutely area it's hardly accessible to acquire a job. In Indonesia, for archetype nike air max 90, even acknowledging baby assets [url=]air max 90[/url] in barter for plan Air Max, however, Nike bargain shoes inside a aught bulk adaptation and utilisation of the circadian needs.. Nike Zoom Vapor VI Tour Men`s tennis shoe is a great shoe popular in the tennis courts. It has Fly wire upper for ultra support and light weight ability, it sits on a frame that gives extra heel support and contains a full-length durable rubber support and herring bone pattern. It also has extra traction for all surfaces of play.. Write a Shakespeare Sonnet without any effort! Express loving [url=]nike free run uk[/url] feelings in a sonnet in Shakespeare's own words in 15 minutes. The rhyme scheme of a Sonnet is a,b,a,b,c,d,c,d,e,f,e,f,g,g. Think of a theme like "love" "death" or "deceit", then choose your lines in the rhyme pattern and put a Sonnet together using the programme

  • Checkbox is checked when using context sensitive help

    Posted by Legacy on 04/08/2002 12:00am

    Originally posted by: Manfred Peter

    Hello Paul,

    first congratulations to your fine work. We use your controls in our project AlligatorSQL - but we had some problems when using this in combination with context sensitive help.
    When we pressed on a checkbox control the value of the box was changed.

    We changed the following line to avoid this problem

    In the function :

    void CMacButtonsCheckBox::OnLButtonUp(UINT nFlags, CPoint point)


    if (rect.PtInRect(point))
    ==> if(m_bMouseDown) m_nCheck = (m_nCheck == 0 ? 1 : 0);

    // Send notify message to parent window.
    // Added by Eric Hwang.

    Thanks again for your controls

    Manfred Peter
    (Alligator Company)

  • value variable and UpdateData...

    Posted by Legacy on 02/18/2002 12:00am

    Originally posted by: DV

    When you create a bolean value variable for the control, you set the variable to 1 and call UpdateData(FALSE) the checkbox state are not updated ?!!!

  • fix resource leak...

    Posted by Legacy on 11/25/2001 12:00am

    Originally posted by: Hyoungsik Woo

    Thansks your work~!

    I found two resource leaks at MacButtons.cpp & one resource leak at MacButtonTestDlg.cpp.
    Add line commented by hswoo.

    ### First resource leak at MacButtons.cpp ################
    ICON CMacButton::SetIcon(HICON hIcon)
    if (hIcon)
    // Get icon dimensions.
    ICONINFO iconInfo;
    ::ZeroMemory(&iconInfo, sizeof(ICONINFO));
    ::GetIconInfo(m_hIcon, &iconInfo); = iconInfo.xHotspot << 1; = iconInfo.yHotspot << 1;

    DeleteObject(iconInfo.hbmColor); // by hswoo.
    DeleteObject(iconInfo.hbmMask); // by hswoo.
    } // SetIcon

    ### Second resource leak at MacButtons.cpp #############
    void CMacButton::DrawPushLikeButton(CDC *pDC, const CRect &rect, UINT nStyle, UINT nState)
    CBrush brFill;

    if (nStyle & BS_FLAT)
    COLORREF crFill = ::GetSysColor(COLOR_WINDOW);

    HBITMAP hBmp = GetDitherBitmap(pDC, crFill, ~crFill);
    CBitmap *pBmp = (hBmp ? CBitmap::FromHandle(hBmp) : NULL);

    if (m_bMouseDown)
    else if (m_nCheck)

    DeleteObject(hBmp); // by hswoo.

    ### resource leak at MacButtonTestDlg.cpp ############
    void CMacButtonTestDlg::OnRadioBitmap()
    HBITMAP hBitmap = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP1));

    DeleteObject(hBitmap); // by hswoo

  • Make buttons "Tranparent"

    Posted by Legacy on 05/17/2001 12:00am

    Originally posted by: Bernd

    Hi, i found out how to make the buttons transparent, meaning having the same bgtColor like its parentWnd

    To manage it do the following:

    open the CMacButton (Baseclass) cpp File
    goto CMacButton::DrawButton

    seek for

    COLORREF bgColor = ::GetSysColor( COLOR_BTNFACE ); // COLOR_WINDOW

    modify the line to:

    COLORREF bgColor = GetOwner()->GetDC()->GetBkColor();

    That's it!!

    Tu try our set the backgroundcolor of your dialog to white or what ever. so are the Buttons have the same bgColor like your dialog.
    (Lokk especially for MacCheckbox and Macradiobutton)



  • why happens the insuffient resource of a message ??

    Posted by Legacy on 10/27/2000 12:00am

    Originally posted by: kwang young

    i used to click Mac Control button,check button...etc
    but the import massege happened sometime.

    the message was the insuffient resource.

    what's problem ??


  • Make this transparent?

    Posted by Legacy on 07/24/2000 12:00am

    Originally posted by: Trey

    Could someone show me how to make the CMacButton transparent?  I'm new to owner drawn controls and any help would be appreciated.


  • flakey CMacMoreButton response to spacebar

    Posted by Legacy on 04/12/2000 12:00am

    Originally posted by: Rick Shide

    Try the spacebar action on the CMacMoreButton controls. The initial space will open the window up, but the arrow doesn't change to point down, subsequent spacebar on an open CMacMoreButton does nothing. If you then click on the CMacMoreButton after it was opened via a spacebar, the arrow then points down. Then hitting a spacebar on the CMacMoreButton when it is pointing down to an open area closes the area but the arrow remains pointing down.

    Nice controls, but you need to do more testing on response to keyboard.

  • Legal ramifications

    Posted by Legacy on 02/16/2000 12:00am

    Originally posted by: JRB

    Be careful, I read somewhere that Apple does not allow the Mac look and feel to be used in apps running on other OS's

  • tab order & focus on radio

    Posted by Legacy on 12/28/1999 12:00am

    Originally posted by: Rick Shide

    Unlike regular radio controls that are in the tab order, your control allows a tab to unset radio controls in a group. Also, selecting a radio control via the spacebar does not change the selection.

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date