VC:CColorDialog(COLORREF)

//     CColorDialog dlg(RGB(255, 0, 0), CC_FULLOPEN);

//dlg.DoModal();

 

//CColorDialog( COLORREF clrInit = 0, DWORD dwFlags = 0, CWnd* pParentWnd = NULL );

/*

CColorDialog dlg;

if (dlg.DoModal() == IDOK)

{

   COLORREF* ccolor = dlg.GetSavedCustomColors();

   for (int i=0; i < 16; i++)

   {

      TRACE("RGB value of the selected color - red = %u, \

         green = %u, blue = %u\n",\

         GetRValue(ccolor[i]), \

         GetGValue(ccolor[i]), \

         GetBValue(ccolor[i]));

   }

}

*/

       CString colormessage="";

       COLORREF init RGB(125,255,0);

       CColorDialog dlg(init);

       if( IDOK==dlg.DoModal())

       {

              COLORREF color=dlg.GetColor();

              colormessage.Format("所选颜色的RGB本别为:(%d,%d,%d)",GetRValue(color),GetGValue(color),GetBValue(color));

              AfxMessageBox(colormessage);

       }

 

你可能感兴趣的:(dialog)