tflex
asked on
Ownerdraw combobox item height
If combobox or listbox is defined as fixed ownerdraw, height of its items is changed by MFC. I am doing the following thing for getting back normal size. But may be there is more simple or elegant solution.
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(GetFont()) ;
TEXTMETRIC tm;
VERIFY (dc.GetTextMetrics ( &tm ));
SetItemHeight (0, tm.tmHeight + 2);
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(GetFont())
TEXTMETRIC tm;
VERIFY (dc.GetTextMetrics ( &tm ));
SetItemHeight (0, tm.tmHeight + 2);
ASKER
Sheeba,
1. What is COLOR_ITEM_HEIGHT?
I want the height to be exactly the same size like non-ownerdrawn item.
2. My ComboBox is not LBS_OWNERDRAWVARIABLE. It is fixed.
1. What is COLOR_ITEM_HEIGHT?
I want the height to be exactly the same size like non-ownerdrawn item.
2. My ComboBox is not LBS_OWNERDRAWVARIABLE. It is fixed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
void CColorListBox::MeasureItem
{
// all items are of fixed size
// must use LBS_OWNERDRAWVARIABLE for this to work
lpMIS->itemHeight = COLOR_ITEM_HEIGHT ;
}
I think this is what u needed