VS错误:没有找到符号 为什么?
我建立一个窗体,在上面加了静态文本框,把它的ID 改成了IDC_STATIC1,然后再程序里面用到,为什么监视的时候总是说找不到符号? 而且的确程序也不满足if条件,进不去。这是为什么?
IDC_STATIC1CXX0017: 错误: 没有找到符号“IDC_STATIC1”
- C/C++ code
HBRUSH CCTDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor){ HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: 在此更改 DC 的任何属性 if (nCtlColor==IDC_STATIC1) { //将文本框IDC_STATIC1设置为透明 pDC->SetBkMode(TRANSPARENT); //返回一个空画刷 return (HBRUSH)GetStockObject(NULL_BRUSH); } return hbr; //return m_brush; 返回另一个画笔 }[解决办法]
你写错了吧,if判断错了吧
if(IDC_STATIC1 == pWnd->GetDlgCtrlID())
{
...
}
#include "resource.h"
[解决办法]
int nID = pWnd->GetDlgCtrlID();
if(nID == "控件ID")
{
............
}
[解决办法]
CWnd::OnCtlColor
afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
Return Value
OnCtlColor must return a handle to the brush that is to be used for painting the control background.
Parameters
pDC
Contains a pointer to the display context for the child window. May be temporary.
pWnd
Contains a pointer to the control asking for the color. May be temporary.
nCtlColor
Contains one of the following values, specifying the type of control:
CTLCOLOR_BTN Button control
CTLCOLOR_DLG Dialog box
CTLCOLOR_EDIT Edit control
CTLCOLOR_LISTBOX List-box control
CTLCOLOR_MSGBOX Message box
CTLCOLOR_SCROLLBAR Scroll-bar control
CTLCOLOR_STATIC Static control