设置对话框ComboBox控件为下拉列表

·

VOID CMyDlg::SetDropDownList(CComboBox* pComboBox)
{
	DWORD  theStyle;
	HWND  theChild;
	theChild = ::GetWindow(pComboBox->m_hWnd, GW_CHILD);
	theStyle = GetWindowLong(pComboBox->m_hWnd, GWL_STYLE);
	theStyle &= ~CBS_DROPDOWN;		//去掉DROPDOWN  
	theStyle |= CBS_DROPDOWNLIST; 	//添加DROPDOWNLIST 
	::DestroyWindow(theChild);
	SetWindowLong(pComboBox->m_hWnd, GWL_STYLE, theStyle);
}

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注