11.04.2014 Views

Advanced MFC Programming

Advanced MFC Programming

Advanced MFC Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 11. Sample: Simple Paint<br />

Color Bar<br />

To implement color bar, a new class derived from CDialogBar is added to the application. This class is<br />

named CColorBar. To let the buttons act as color selection controls, we need to implement subclass for all<br />

the owner-draw buttons. In the sample, function CColorBar::InitButtons() is added to initialize the<br />

indices of all the buttons and implement subclass. Also, function CDialogBar::Create(…) is overridden,<br />

within which CColorBar::InitButtons() is called to change the default properties of the buttons. The<br />

following is the implementation of function CColorBar::InitButtons():<br />

BOOL CColorBar::InitButtons()<br />

{<br />

int i;<br />

}<br />

for(i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!