I have a CComboBox based Custom ComboBox with CBS_OWNERDRAWVARIABLE. The items in Comboxbox are shown when the DPI is 96. But when DPI is greater 96 then items are not shown. I could not figure out what could be the issue. When I change CBS_OWNERDRAWVARIABLE to CBS_OWNERDRAWFIXED then everything is working fine.
When Scale & Layout value is 100% everything works fine. But if the scale percent is more than 100 then the items are not shown.
when scale percent = 100
when scale percent greater than 100

My code snippet for DrawItem & MeasureItem.
void CMyComboBox::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
if (lpMeasureItemStruct->itemID != -1)
{
lpMeasureItemStruct->itemHeight = 16;
}
}
void CMyComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
ASSERT(lpDrawItemStruct->CtlType == ODT_COMBOBOX);
LPCTSTR lpszText = (LPCTSTR)lpDrawItemStruct->itemData;
ASSERT(lpszText != NULL);
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);
// Save these value to restore them when done drawing.
COLORREF crOldTextColor = dc.GetTextColor();
COLORREF crOldBkColor = dc.GetBkColor();
// If this item is selected, set the background color
// and the text color to appropriate values. Erase
// the rect by filling it with the background color.
if ((lpDrawItemStruct->itemAction & ODA_SELECT) &&
(lpDrawItemStruct->itemState & ODS_SELECTED))
{
dc.SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
dc.SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
dc.FillSolidRect(&lpDrawItemStruct->rcItem, ::GetSysColor(COLOR_HIGHLIGHT));
}
else
{
dc.FillSolidRect(&lpDrawItemStruct->rcItem, crOldBkColor);
}
// Draw the text.
dc.DrawText(
lpszText,
(int)_tcslen(lpszText),
&lpDrawItemStruct->rcItem,
DT_CENTER | DT_SINGLELINE | DT_VCENTER);
// Reset the background color and the text color back to their
// original values.
dc.SetTextColor(crOldTextColor);
dc.SetBkColor(crOldBkColor);
dc.Detach();
}

