Solved

List View cell size limit?

Posted on 1998-07-22
3
358 Views
Last Modified: 2012-05-04
Is there a limit to the number of characters a list view cell can display? It appears the limit is 255?
0
Comment
Question by:rascal
[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
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 50 total points
ID: 1168383
Try using the ListView_GetStringWidth() and ListView_SetColumnWidth() macros.


The ListView_GetStringWidth macro determines the width of a specified string, using the specified list view control's current font. You can use this macro or explicitly send the LVM_GETSTRINGWIDTH message.

int ListView_GetStringWidth(
    HWND hwnd,       
    LPCSTR psz      
   );      
 
Parameters
hwnd - Handle to the list view control.
psz - Pointer to a null-terminated string.
 
Return Values - Returns the string width if successful or zero otherwise.


The ListView_SetColumnWidth macro changes the width of a column in report or list view. You can use this macro or explicitly send the LVM_SETCOLUMNWIDTH message.
BOOL ListView_SetColumnWidth(
    HWND hwnd,       
    int iCol,       
    int cx      
   );      
 
Parameters
hwnd - Handle to the list view control.
iCol - Index of the column. In list view, the iCol parameter must be -1.
cx - New width of the column, in list view coordinates, or one of the following values:
LVSCW_AUTOSIZE - Automatically sizes the column.
LVSCW_AUTOSIZE_USEHEADER - Automatically sizes the column to fit the header text.

0
 
LVL 1

Author Comment

by:rascal
ID: 1168384
Thanks, but I need to know if there is an upper limit that the column display. I will try the sample code you provided with various length strings but I need to know if there is an explicit upper boundary of length a list view column can support. Thanks again.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1168385
Actually, there is a limit because the argument to LVM_SETCOLUMNWIDTH is a positive WORD.  Thus the limit is 32K pixels.  The number of characters depends on the font.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamically allocate memory 9 70
How to gracefully close the c++ 11 thread? 3 122
Best book to learn C++ 4 87
DCT of  2D array using fftw in c++ 9 92
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

756 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