Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I know the way use MesureItem to set the height of rows, but can't set them in different height.
thinks, ahead of time.
Posted
Updated 13-Mar-11 17:13pm
v2

Have you see this CP Article that does what you looking in an owner drawn control?

Changing Row Height in an owner drawn Control[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 13-Mar-11 23:29pm    
I voted 5 but then checked the article and did not find LBS_OWNERDRAWVARIABLE in the text, only LBS_OWNERDRAWFIXED (see my Answer). Does this article really address all problems of the height? (I did not see the source code though.)
--SA
ITGrit 14-Mar-11 20:16pm    
I have read CP Article, but it's helpless for me to let the rows have different height.In CP Article, I can konw how to set the height of rows, but all the rows will have the same height.However I want the rows have different height.
Thinks.
Yusuf 14-Mar-11 21:07pm    
Then you are using the wrong control. Many times many people stick to something and try to solve it using only that method. Instead re-define what you want to solve and keep your options open. Can ListView or Grid Control the job for you?
ITGrit 16-Mar-11 6:15am    
I believe it's really a problem that I want about CListCtrl.
The Question is not formulated clearly. Maybe you mean that your you need different items if your List Box to be of different heights? Then you need to OR the style LBS_OWNERDRAWVARIABLE to your list box style bit set, not LBS_OWNERDRAWFIXED. See http://msdn.microsoft.com/en-us/library/tdzk1x67(v=vs.80).aspx[^].

—SA
 
Share this answer
 
v2
Comments
ITGrit 14-Mar-11 20:26pm    
Sorry, and I want different rows in List Control to be different heights.
I believe the way you mentioned would be a good one about List Box, but what I want should in List Control.Thinks and wait your more answer.
Sergey Alexandrovich Kryukov 14-Mar-11 20:43pm    
Opps! Sorry, I did not read properly.
According to this, it is not solvable with list view control:
http://forum.soft32.com/pda/Variable-height-owner-drawn-listview-ftopict63877.html
--SA
Espen Harlinn 15-Mar-11 11:28am    
My 5 - LBS_OWNERDRAWVARIABLE with handling of WM_MEASUREITEM and WM_DRAWITEM
http://social.msdn.microsoft.com/Forums/eu/vcgeneral/thread/5e4b0be1-8c87-4a84-8a85-85a0b0e2455c
Sergey Alexandrovich Kryukov 15-Mar-11 12:50pm    
Thank you, but probably this it does not make an answer, as I answered for list box, not list view.
I don't think you're right up-voting my answer this time :-<
--SA
Espen Harlinn 15-Mar-11 13:56pm    
The procdure is valid for multiple controls - from the WM_MEASUREITEM Message
documentation:Sent to the owner window of a combo box, list box, list-view control, or menu item ... The MFC documentation focuses on MFC - so you often have to go to the API documentation when you want to figure things out.
I think the only way for me is drawing the control by using CHeadCtrl and CWnd. Thanks a lot.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900