您的位置:首页 > 其它

MFC中int转化cstring

2013-12-08 22:10 459 查看
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);

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: