Solved

How to change list view control items height

Posted on 1998-09-04
10
444 Views
Last Modified: 2013-11-20
How can i change list view control items height in report mode?

Thanks in advance.
0
Comment
Question by:fjsen
10 Comments
 
LVL 1

Expert Comment

by:Bridge
ID: 1321721
Just use a bigger font.
0
 
LVL 2

Expert Comment

by:prasanth
ID: 1321722
One way is to SetImageList with a bitmap that is the height that you want the row to be. If you don't really want images but just the height, use a bitmap 1 pixel wide and the height you want filled with the background color of the image list.
0
 

Author Comment

by:fjsen
ID: 1321723
I don't want a workaround to set the height throught SetImageList. I want to set the height with something like this: SetItemHeight(int iHeight). I don't want to use images.

Thanks.

0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 1

Expert Comment

by:sudhirbrat
ID: 1321724

fjsen,

Override the message WM_MEASUREITEM in the class where you have the list control.

There you have MEASUREITEMSTRUCT structure as argument.
This structure has the height variable.

If the control ID is of list control set height of structure.
0
 

Author Comment

by:fjsen
ID: 1321725
I think listview controls don't send WM_MEASUREITEM messages to their parents. What can i do?

Thanks.

0
 
LVL 1

Expert Comment

by:sudhirbrat
ID: 1321726

The list control style must be "OwnerDraw Fixed".
Check this style in Properties dialog.
And you need to draw the items in the list control. To do this you need to override WM_DRAWITEM meesage also.

the message "WM_MEASUREITEM" is called by list control only at the creation of list control and when resizing the control with the help of functions like "MoveWindow".

This worked fine for me.
0
 

Author Comment

by:fjsen
ID: 1321727
Sorry, but i don't want to draw the items in the list control. I don't want an ownerdraw list control.

Thanks.

0
 
LVL 1

Accepted Solution

by:
sudhirbrat earned 50 total points
ID: 1321728
If you try in this, the problem may be solved.

Derive your own list control class from CListCtrl and override WM_MEASUREITEM.

Subclass your list control in the dialog to your derived class.
0
 

Author Comment

by:fjsen
ID: 1321729
I've derived my own class from CListCtrl and handled the WM_MEASUREITEM message. I don't receive this message if the control isn't ownerdraw. I don't want to draw items.

Thanks.

0
 

Expert Comment

by:ashugarg00
ID: 13232808
In a owner draw list conrol we cannot set the LVS_OWNERDRAWVARIABLE flag to change the item height.please confirm and let me know!!!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli‚Ķ
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question