i'm trying set different font to listctrl
(to keep it's row height independent to small-large fonts settings)
but
i found when i in OnCreate set the same font as actualy is selected
than in DrawItem i receive absolutely different one
(tahoma/400-weight from OnCreate changes to system/700 in DrawiItem)
(also my change in DrawItem - see down - has no influence)
any ideas what i'm doing wrong?
any good example for me (to keep my old DrawItem code)?
thanks
(i'm using some tricks from
http://www.codeproject.com/listctrl/changerowheight.asp
but seems my OnSetFont and MeasureItem have no infulence to my problem)
CMyListCtrl::OnCreate
{
if(CListCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
LOGFONT olf;
GetFont()->GetLogFont(&olf);
CFont NewFont;
if(NewFont.CreateFontIndirect(&olf))
{
LOGFONT nlf;
NewFont.GetLogFont(&nlf);
m_pOldFont = GetFont();
SetFont(&NewFont);
}
}
CNemAttributesListCtrl:: DrawItem
{
CDC* pDC=CDC::FromHandle(lpDrawItemStruct->hDC);
CFont *pOldFont = pDC->SelectObject(GetFont());
LOGFONT olf;
//here will be ret==0: int ret = GetFont()->GetLogFont(&olf);
pDC->GetCurrentFont()->GetLogFont(&olf);
...
}
p.s.
i want to keep headerctrl height too
but with
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
pHeaderCtrl->SetFont(&NewFont);
into listctrl OnCreate is h-ctrl's size ok but text inside is bit down
(= it seems text left-bottom position does not change with SetFond)
