MFC 颜色选择对话框、颜色按钮

COLORREF color=RGB(0,255,0);

unsigned char r=GetRValue(color);

unsigned char g=GetGValue(color);

unsigned char b=GetBValue(color);

-------------------------------------

CColorDialog colorDialog;
COLORREF color;
if( colorDialog.DoModal() == IDOK )
{
     color = colorDialog.GetColor();
}

-------------------------------------

((CMFCColorButton*)GetDlgItem(IDC_MFCCOLORBUTTON1))->SetColor(RGB(204,204,204));

COLORREF color=((CMFCColorButton*)GetDlgItem(IDC_MFCCOLORBUTTON1))->GetColor();

posted @ 2013-12-04 17:33  酷熊  阅读(1765)  评论(0编辑  收藏  举报