关于MFC里自己写Clistbox的问题。
来源:百度知道 编辑:UC知道 时间:2024/05/20 09:21:53
但是不派生,直接在对话框中修改OnCtlColor函数,就可以改变背景颜色,,,
我不知道为什么,有点不明白呢。
积分八多,,,省些哈。。。
自己看看吧,这是最权威的函数说明。
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
Remarks
The framework calls this member function when a child control is about to be draw