Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

The Color Dialog


Suppose we would like to increase the color palette from three colors to every color available in the RGB standard (more than 16 millions). We can do so by adding another menu item and letting it launch the MFC color dialog.

RingDoc.cpp

void CRingDoc::OnColorDialog()
{
  CColorDialog colorDialog(m_nextColor);

  if (colorDialog.DoModal() == IDOK)
  {
    m_nextColor = colorDialog.GetColor();
  }
}

When the user chooses the color dialog menu item, the color dialog will launch.