?
Solved

CListCtrl Report Style Row Height

Posted on 2000-04-14
9
Medium Priority
?
1,663 Views
Last Modified: 2013-11-20
I want to be able to set the row height of a CListCtrl in Report stlye.  The column width can be easily set, but I can not find access to the height attribute.

I would prefer to use CustomDraw instead of using setting the owner drawn attribute.  Besides, I don't think this effects a list in Report style anyway.  

I just want wider rows with the rest of the default behavior as is.

How do I do this?
0
Comment
Question by:sidney091097
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:MT_MU
ID: 2717021
I suspect the easiest way is to change the font.

Assuming you are using this in a dialog, do something like the following in OnInitialUpdate()


CFont* pFont = m_List.GetFont(); // get the current font
LOGFONT logfont;
pFont->GetLogFont(&logfont);  // and it's characteristics - for me this returns lfHeight = -11;

logfont.lfHeight = -14;  // set a new height

m_NewFont = new CFont;  // create a new font
m_NewFont->CreateFontIndirect(&logfont); // with the appro characteristics
m_List.SetFont(m_NewFont); // and tell the list control to use it
0
 

Author Comment

by:sidney091097
ID: 2717419
This works except that in order to get the height I want, I have to use a font that is too big.  In addition, this effects the font of the header title which I do not want.

Thanks anyway,
Cindy
0
 

Author Comment

by:sidney091097
ID: 2717647
This works except that in order to get the height I want, I have to use a font that is too big.  In addition, this effects the font of the header title which I do not want.

Thanks anyway,
Cindy
0
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 
LVL 11

Expert Comment

by:mikeblas
ID: 2717911
> I just want wider rows

Er, do you want wider rows, or taller rows?

..B ekiM
0
 
LVL 1

Expert Comment

by:jianliuer
ID: 2718388
Maybe you can change the image's size stored in your imagelist.


    m_LargeImageList.Create(sizex,sizey,ILC_COLOR24|ILC_MASK,10,1000);
    ListCtrl.SetImageList(&m_LargeImageList, LVSIL_SMALL);



Good Luck!
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 2721419
> change the image's size stored in your imagelist.

If you have memory to burn, I guess that's a good idea.  An image list, even when metpy, is going to use some memory based on the size of the bitmaps you've indicated you will record in it. Manipulating the image list to change the height of rows is wasteful.

..B ekiM
0
 

Author Comment

by:sidney091097
ID: 2723296
First, I would like to set the row HEIGHT.  Sorry for the confusion.

Second, I don't think changing the size of the bitmap is a good solution.

There's got to be a way of getting to this attribute.  CCtrlList inherits from CWnd, but I'm not sure how to handle these subitems.

0
 
LVL 11

Accepted Solution

by:
mikeblas earned 800 total points
ID: 2724759
The only way to do it is with ownerdraw.

 sidney> There's got to be a way of getting to this attribute.  

I'm afraid there isn't. There's not necessarily a way to access any attribute in every situation for every control.  Sure, it would be nice. But the controls are implemented by Windows, and Windows may or may not have included the ability to set those parameters.

You can start out with the ROWLIST sample that comes with Visual C++. Check out the CListViewEx::DrawItem() structure, and play with the way it initializes lpDrawItemSTruct->rcItem. You can adjust that size.

You'll probably want to steal lots of code from that sample to avoid rewriting it yourself.

..B ekiM
0
 
LVL 3

Expert Comment

by:V_Bapat
ID: 2730221
You can take the DrawItem() code from ROWLIST sample.

But for changing the height of the row, simply handle WM_MEASUREITEM. Change lpMeasureItemStruct->itemHeight to the height you require.

If you don't find the message in the ClassWizard add it yourself. Add this line before END_MESSAGE_MAP() in the cpp file:
ON_WM_MEASUREITEM_REFLECT()

In the .h file add the following line just before DECLARE_MESSAGE_MAP():
afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);

Vicky
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month14 days, 8 hours left to enroll

770 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