主要代码如下:在MainFrame 中:CDialogBar m_wndLeftDialogBar;
if (!m_wndLeftDialogBar.Create(this, CG_IDD_LEFTDIALOGBAR,
CBRS_LEFT | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE,
CG_ID_VIEW_LEFTDIALOGBAR))
{
TRACE0("Failed to create dialog bar m_wndLeftDialogBar\n");
return -1; // fail to create
}
在 m_wndLeftDialogBar所在的cpp 代码中我定义了
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
return m_brush;
// TODO: Return a different brush if the default is not desired
//return hbr;
}问题是MainFrame不响应这个函数 我设置了断点~这个函数根本就没有用到~这样我改变不了这个CDialogBar 的颜色 请问应该怎么样才能让MainFrame 响应这个函数
if (!m_wndLeftDialogBar.Create(this, CG_IDD_LEFTDIALOGBAR,
CBRS_LEFT | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE,
CG_ID_VIEW_LEFTDIALOGBAR))
{
TRACE0("Failed to create dialog bar m_wndLeftDialogBar\n");
return -1; // fail to create
}
在 m_wndLeftDialogBar所在的cpp 代码中我定义了
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
return m_brush;
// TODO: Return a different brush if the default is not desired
//return hbr;
}问题是MainFrame不响应这个函数 我设置了断点~这个函数根本就没有用到~这样我改变不了这个CDialogBar 的颜色 请问应该怎么样才能让MainFrame 响应这个函数
{
HBRUSH hbr = CDialogBar::OnCtlColor(pDC, pWnd, nCtlColor);
。。
}
{
CBrush brush(RGB(255,0,0));
CRect rectClient;
GetClientRect(rectClient); pDC->FillRect(rectClient, &brush); return TRUE;
}