Partager via


CColorDialog::GetColor

Call this function after calling DoModal to retrieve the information about the color the user selected.

COLORREF GetColor( ) const;

Return Value

A COLORREF value that contains the RGB information for the color selected in the color dialog box.

Example

// Get the selected color from the CColorDialog.
CColorDialog dlg;
if (dlg.DoModal() == IDOK)
{
   COLORREF color = dlg.GetColor();
   TRACE(_T("RGB value of the selected color - red = %u, ")
      _T("green = %u, blue = %u\n"),
      GetRValue(color), GetGValue(color), GetBValue(color));
}

Requirements

Header: afxdlgs.h

See Also

Reference

CColorDialog Class

Hierarchy Chart

CColorDialog::SetCurrentColor

Other Resources

CColorDialog Members