Search code examples
windowswinapimfcwin32gui

How to set height of items in droplist CComboBox


I am trying to set height for each item present in CComboBox drop list. I have setitemheight API but it is not changing height of each item in list. I have used SetFont as well but no automatic resizing either. check image for issue with height


Solution

  • Problem seems like I have overridden DrawItem , hence I have made minor change there to fix issue:

    GetLBText(lpDrawItemStruct->itemID, strText);
    lpDrawItemStruct->rcItem.bottom += 2;  // this solved my problem
    dc.ExtTextOutW(
                    lpDrawItemStruct->rcItem.left,
                    lpDrawItemStruct->rcItem.top,
                    ETO_OPAQUE,
                    &lpDrawItemStruct->rcItem,
                    strText,
                    strText.GetLength(),
                    NULL
                    );