还是不懂 : error C2039: 'SetCheck' : is not a member of 'CWnd'
GetDlgItem(ID)->SetCheck(1); 这句是放在哪里的 阿
放了,但出现错误啊 error C2039: 'SetCheck' : is not a member of 'CWnd' e:\software\microsoft visual studio\vc98\mfc\include\afxwin.h(1899) : see declaration of 'CWnd' Error executing cl.exe.
放了,但出现错误啊 error C2039: 'SetCheck' : is not a member of 'CWnd' e:\software\microsoft visual studio\vc98\mfc\include\afxwin.h(1899) : see declaration of 'CWnd' Error executing cl.exe.
: error C2039: 'SetCheck' : is not a member of 'CWnd'
这句是放在哪里的 阿
error C2039: 'SetCheck' : is not a member of 'CWnd'
e:\software\microsoft visual studio\vc98\mfc\include\afxwin.h(1899) : see declaration of 'CWnd'
Error executing cl.exe.
error C2039: 'SetCheck' : is not a member of 'CWnd'
e:\software\microsoft visual studio\vc98\mfc\include\afxwin.h(1899) : see declaration of 'CWnd'
Error executing cl.exe.
你先把CHECKBOX控件添加成成员变量,比如变量名起为m_Check1,再加上
m_Check1.SetCheck(BST_CHECKED);
设该CheckBox控件ID为IDC_CHECK1,
在Dialog类的OnInitDialog函数中//TODO处添加代码:
((CButton*)GetDlgItem(IDC_CHECK1))->SetCheck(BST_CHECKED);
方法二:
为该控件添加BOOL值型控件成员变量m_Check1,在Dialog类的构造函数中将m_Check1=TRUE;
方法三:
为该控件添加CButton Control型控件成员变量m_CheckCtrl1,
在Dialog类的OnInitDialog函数中//TODO处添加代码:
m_CheckCtrl1.SetCheck(BST_CHECKED);
不管什么地方写,赋成true或发false后,UpdateData(false);