我有一个派生自CListCtrl的类,名为CListCtrlExt,我需要更改滚动条的颜色......我怎样才能实现呢? 我做了一个试验,就像那样:
HBRUSH CListCtrlExt::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CListCtrl::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(CTLCOLOR_SCROLLBAR == nCtlColor)
{
pDC->SetBkColor(RGB(0, 0, 0));
HBRUSH b = CreateSolidBrush(RGB(233,233,220));
return b;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
甚至没有通过这里...另一个试验:
HBRUSH CTestDlg2Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(pWnd == GetDlgItem(IDC_LIST1) && CTLCOLOR_SCROLLBAR == nCtlColor)
{
pDC->SetBkColor(RGB(0, 0, 0));
HBRUSH b = CreateSolidBrush(RGB(0, 0, 0));
return b;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
不工作...... 我还有一个CScrollbarEx(来自here),但我不知道如何将它附加到我的CListCtrlExt上...你能帮助我吗?