200分 一个LISTCTRL 无法改变列高的有关问题

200分 求助一个LISTCTRL 无法改变列高的问题
一个继承CListCtrl 的自绘控件 CAppearanceListCtrl

Report风格,Onwer Draw Fix 属性


void CAppearanceListCtrl::MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct )
{
LOGFONT lf;
GetFont()->GetLogFont( &lf );

if ( lf.lfHeight < 0 )
lpMeasureItemStruct->itemHeight = -lf.lfHeight + m_nItemExternHeight; 
else
lpMeasureItemStruct->itemHeight = lf.lfHeight + m_nItemExternHeight; 

}

void CAppearanceListCtrl::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CListCtrl::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
//MeasureItem(lpMeasureItemStruct);
}



添加了 MeasureItem 和 OnMeasureItem 就成这样迭代样式了,如图:

200分 一个LISTCTRL 无法改变列高的有关问题

------解决方案--------------------
m_nItemExternHeight 改大一些试试

把你算出来的lpMeasureItemStruct->itemHeight调大一些

实在不想仔细看代码,直接加个固定值,到自己满意为止
lpMeasureItemStruct->itemHeight = -lf.lfHeight + m_nItemExternHeight + 10;


------解决方案--------------------
通过 font 来 改变 列高
SendMessage(m_hListView,WM_SETFONT,(WPARAM)m_hFont,0);
------解决方案--------------------
看看这个例子会不会对你有帮助
http://www.codeproject.com/Articles/1401/Changing-Row-Height-in-an-owner-drawn-Control
------解决方案--------------------
把分都给我,交你一招
// 为了保证第一次显示的结果就是正确的,所以在添加ITEM的时候,就需要设置高度
int iCnt = this->GetCount();
for(int i = 0; i < iCnt; i++) {
this->SetItemHeight(i, CONST_INT_DEFAULT_ITEM_HEIGHT);
}
200分 一个LISTCTRL 无法改变列高的有关问题