颜色对话框使用问题!!!
各位前辈好!我刚学VC,有个问题问一下,勿见笑:
我要为画的图形用颜色对话框选择颜色,这是我写的步骤:
1、通过“颜色选择”按钮,产生颜色对话框,
void CSetlineDlg::OnSellinecolor()
{
// TODO: Add your control notification handler code here
CColorDialog dlg;
if(dlg.DoModal()==IDOK)
{
COLORREF lineColor=dlg.GetColor(); //
}
}
2、将lineColor当作CPen pen( PS_SOLID , linewidth , color );中的color
运行时,图形颜色没有改变,不知道问题怎么解决?(在线等~~)
[解决办法]
lineColor这个是个临时变量怎么会变颜色呢,改成类的成员变量就OK了