Click here to Skip to main content
12,998,892 members (31,267 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I can't change size of my rows in this CListCtrl:
class CResolutionListCtrl : public CMFCListCtrl

That's a method that I realize in class, according different tutorials:

afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct );
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);


I can't change height in any ways:
even with this very popular tutorial
Changing Row Height in an owner drawn Control[^]

And actually my OnMeasureItem and MeasureItem never call. I've already tried change different flags like:
owner Draw etc.
Please provide some simple example to change size of cell, because everything that I found is really a lot of coding or doesn't work.
Thank you a lot
Posted 26-Jun-13 3:10am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If your OnMearureItem is not called at least once that is an indication that the control is not an owner-draw control. You might want to use Spy++ to check that.

Perhaps the following snippet from the MSDN documentation will help you find the reason for that:

OnMeasureItem will be called only if the control's class is created at run time, or it is created with the LBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWVARIABLE style. If the control is created by the dialog editor, OnMeasureItem will not be called. This is because the WM_MEASUREITEM message is sent early in the creation process of the control. If you subclass by using DDX_Control, SubclassDlgItem, or SubclassWindow, the subclassing usually occurs after the creation process. Therefore, there is no way to handle the WM_MEASUREITEM message in the control's OnChildNotify function, which is the mechanism MFC uses to implement ON_WM_MEASUREITEM_REFLECT.

For more see[^]

Hope that solves your problem.
thomas_wingfield 26-Jun-13 10:01am
Hello nv3)
Thanks for replaying. I will try right now

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 26 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100