Click here to Skip to main content
15,878,748 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,

I want to increase the height of the combobox control.Increasing the width of the combobox control is happening but when I am trying to increase the height of the control I am not able to drag it downwards.

I googled for long time and I did not find any answer, everywhere they are mentioning how to increase the height of the combo text but not the control height.


Can anyone please let me know how can I increase the height of the combobox control.



Thanks in advance,
Raja
Posted
Updated 10-Jul-17 16:22pm
Comments
Jochen Arndt 26-Jan-15 9:44am    
Which height do you mean (the height of the edit/static field or for the dropdown area) and how do you want to set the height (programmatically or with the resource editor)?

The C++'s SetItemHeight example from MSDN:

C++
// Set the height of every item to be the 
// vertical size of the item's text extent.
CString str;
CSize   sz;
CDC*    pDC = m_pComboBox->GetDC();
for (int i = 0; i < m_pComboBox->GetCount(); i++)
{
   m_pComboBox->GetLBText(i, str);
   sz = pDC->GetTextExtent(str);

   m_pComboBox->SetItemHeight(i, sz.cy);
}
m_pComboBox->ReleaseDC(pDC);


Good luck,
Herb
 
Share this answer
 
Comments
RajaPratap 27-Jan-15 4:32am    
Thanks for your reply.I have also done the same thing.After doing as above the size got increased(vertical height).But the text is not at the centre.It is exactly at the top.Normally if we take a standard combo box the text in the control seems to aligned correctly.Now,when I increased the height the text remains in the same position. Doesn't it move down when we increase the height(I mean to be aligned correctly).Can you please let me know how can get this done.
To change the visual height, you need to make it OwnerDrawn and implement MeasureItem() function like:

void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
lpMeasureItemStruct->itemHeight = 17;
}

Here is a good example:
IconComboBox - Selecting Icons[^]
 
Share this answer
 
Comments
barneyman 11-Jul-17 0:32am    
this question is >2.5 years old

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900