?
Solved

List View cell size limit?

Posted on 1998-07-22
3
Medium Priority
?
361 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 100 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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

777 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