Link to home
Start Free TrialLog in
Avatar of elcapitan
elcapitan

asked on

Changing rowsheight in CListCtrl

Hi All,
I tried to change font size of CListCtrl object. Unfortunately the row height of the control was not updated, and the text got clipped. I tried to run my app on win 98 as well as win NT.

Any suggestions?

p.s.
Please, Real answares. Not links to codeguru or codeproject

--EC--
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Sorry for the "unreal" answer:

http://www.codeproject.com/listctrl/changerowheight.asp

You're going to have to a little reading :)


Avatar of elcapitan
elcapitan

ASKER

This article is dealing with owner draw controls. I'm not interesting in drawing the control my self. Is there another way to do that? maybe custom draw?
Use the techniques decribed for WM_MEASUREITEM. I briefly tried out the technique using the dialog's message mapping and it worked fine:

BEGIN_MESSAGE_MAP(CGrantBrowse, CAuxiliaryDialog)
  // ...
  ON_WM_MEASUREITEM()
  // ...
END_MESSAGE_MAP()

void CMyDlg::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
  if (nIDCtl == IDC_MYLISTCTRL)
    lpMeasureItemStruct->itemHeight = 20;
  else
    CDialog::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
}

There appears to be a way to redirect the measure item message using reflection so that the subclassed control is more usable. Rather than relying on the container window having to resize the control's height.

Good Luck,
Steve

ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial