Re: How to limit the coloumns in a listview to the header text using API



On Sat, 2 Sep 2006 17:00:26 -0400, "Randy Birch"
<rgb_removethis@xxxxxxxx> wrote:

Can you give an example of what you want to achieve?


Hello Randy,
Thanks for your reply.

What am I trying to achieve?
Well, I'm using the folowing API call to autosize a listview:

code snippet:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam
As Any) As Long
------------------

This works great as long as I don't use headerICONS.

To workararound this problem I added a For Next loop to set a minimum
column width. For this purpose I'm first trying to dertermine the
width of the headertext using (form.textwidt). However, the found
widthvalue of the headertext is not enough to display the headertext
correctly. For that reason I added 200 for some margin.

code snippet:
minimum = form1.TextWidth(form1.listview1.ColumnHeaders.Item(I).Text)
+ lIconColWidth + 200
-------------

explanation:
lIconColWidth is used as an option in the function to preset the
widthvalue for the headericon. I set the value to 700 for an 32x32
icon.


In the end its seems to be working, but i't doensn't give me the
feeling that its reliable. (let alone efficiently)


So the real problem is: How to autosize listviewcolumns when using
headerIcons.


Greetings,

Farmer















.


Loading