void SetDropDownHeight(CComboBox* pMyComboBox, int itemsToShow) { //Get rectangles CRect rctComboBox, rctDropDown; //Combo rect pMyComboBox->GetClientRect(&rctComboBox); //DropDownList rect pMyComboBox->GetDroppedControlRect(&rctDropDown); //Get Item height int itemHeight = pMyComboBox->GetItemHeight(-1); //Converts coordinates pMyComboBox->GetParent()->ScreenToClient(&rctDropDown); //Set height rctDropDown.bottom = rctDropDown.top + rctComboBox.Height() + itemHeight*itemsToShow; //apply changes pMyComboBox->MoveWindow(&rctDropDown); }
SetDropDownHeight(&m_CodeAgence, 5);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)