Re: CComboBox question...
Just use SetItemHeight()
MSDN Code:
Code:
// The pointer to my combo box.
extern CComboBox* pmyComboBox;
// Set the height of every item to be the
// vertical size of the item's text extent.
CString str;
CSize sz;
int dx=0;
CDC* pDC = pmyComboBox->GetDC();
for (int i=0;i < pmyComboBox->GetCount();i++)
{
pmyComboBox->GetLBText( i, str );
sz = pDC->GetTextExtent(str);
pmyComboBox->SetItemHeight( i, sz.cy );
}
pmyComboBox->ReleaseDC(pDC);
Re: CComboBox question...
I think you are looking for SetDroppedWidth() and SetHorizontalExtent().
Re: CComboBox question...
You can specify the height of the drop down list by using the CB_SETMINVISIBLE message or the ComboBox_SetMinVisible macro, however that is for Windows XP or later only.
You can also change the height of the listbox by using SetWindowPos.
Re: CComboBox question...
CB_SETMINVISIBLE is ok, but it requires Windows XP. For a more generic solution use the code bellow:
Code:
// assuming cbo is a CComboBox
CRect rect;
cbo.GetWindowRect( rect);
rect.bottom += 100;
cbo.MoveWindow( rect);
Basically, setting the Combo's height affects the height of the drop list.
Re: CComboBox question...
Quote:
Originally Posted by PadexArt
CB_SETMINVISIBLE is ok, but it requires Windows XP. For a more generic solution use the code bellow:
Exactly, that's why I edited my post immediately after posting it ;)
Re: CComboBox question...
Quote:
Originally Posted by Marc G
Exactly, that's why I edited my post immediately after posting it ;)
I was adding my answer at the same time (11:01 - 11:02). ;)