点击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);
}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值