Creating a Non-Rectangular Button

Most buttons that we create either in dialogs or in windows are rectangular in shape. In this article we would see how to create non-rectangular buttons. This project has been created using 'MFC AppWizard (exe)' without the Document/View architecture support. To create non-rectangular button CBitmapButton object is used. The CBitmapButton class encapsulates owner drawn push buttons that display pictures instead of text. The button has been created by calling CBitmapButton::Create( ) function. The first parameter passed to the function is NULL since no text is to be displayed on the button. The style BS_OWNERDRAW has been included since the button is owner drawn. Once the button is created a pair of bitmaps is loaded for the button. These bitmaps should naturally be created using the Resource Editor.

No comments: