如何设置下拉列表CComboBox中项目的高度

How to set height of items in droplist CComboBox

我正在尝试为 CComboBox 下拉列表中的每个项目设置高度。我有 setitemheight API 但它没有改变列表中每个项目的高度。我也使用了 SetFont 但也没有自动调整大小。

问题似乎是我覆盖了 DrawItem ,因此我在那里做了一些小改动来解决问题:

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
                );