点击CComboBox控件的下拉按钮控制下拉框ListBox的显示和隐藏

/*
The WM_CTLCOLORLISTBOX message is sent to the parent window of a list box 
before the system draws the list box. By responding to this message, the 
parent window can set the text and background colors of the list box by 
using the specified display device context handle. 

A window receives this message through its WindowProc function.
*/

/*从MSDN上可以清楚的看到WM_CTLCOLORLISTBOX是用来自绘CComboBox下得ListBox控件的,
这里需重写CComboBox类,在虚函数中WindowProc处理WM_CTLCOLORLISTBOX消息。*/

// 从这里可以很容易的看到这里很容易来控制显示和隐藏ComboBox控件的下拉框ListBox控件

LRESULT CNewComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(WM_CTLCOLORLISTBOX == message)
	{
		HWND hListBox = (HWND)lParam;
		::ShowWindow(hListBox, SW_HIDE);
	}
	return CComboBox::WindowProc(message, wParam, lParam);
}

你可能感兴趣的:(list,System,colors)