void CColorDlgDlg::OnBnClickedColorButton()
{
// TODO: 在此添加控件通知处理程序代码
COLORREF color = RGB(255, 0, 0);
CColorDialog colorDlg(color);
if (IDOK == colorDlg.DoModal())
{
color = colorDlg.GetColor();
SetDlgItemInt(IDC_COLOR_EDIT, color);
/*SetDlgItemInt(IDC_R_EDIT, GetRValue(color));
SetDlgItemInt(IDC_G_EDIT, GetGValue(color));
SetDlgItemInt(IDC_B_EDIT, GetBValue(color));*/
CString cstrR;
CString cstrG;
CString cstrB;
cstrR.Format(_T("%d"), (unsigned int)GetRValue(color));
cstrG.Format(_T("%d"), (unsigned int)GetGValue(color));
cstrB.Format(_T("%d"), (unsigned int)GetBValue(color));
SetDlgItemText(IDC_R_EDIT, cstrR);
SetDlgItemText(IDC_G_EDIT, cstrG);
SetDlgItemText(IDC_B_EDIT, cstrB);
}
}
MFC中int转化cstring
最新推荐文章于 2021-05-19 21:20:41 发布