Thanks Frank. I've committed a change that uses this code for the 2
listviews on frmMain, and the SQL data grid.

Regards, Dave.

> -----Original Message-----
> From: frank_lupo [mailto:[EMAIL PROTECTED]] 
> Sent: 10 February 2003 11:06
> To: pgadmin-hackers
> Subject: [pgadmin-hackers] Auto size column listview
> 
> 
> Public Declare Function SendMessage Lib "user32" Alias 
> "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal 
> wParam As Long, lParam As Any) As Long
> 
> 
> 
> Public Const LVM_FIRST As Long = &H1000
> 
> Public Const LVM_SETCOLUMNWIDTH As Long = (LVM_FIRST + 30)
> 
> Public Const LVSCW_AUTOSIZE As Long = -1
> 
> Public Const LVSCW_AUTOSIZE_USEHEADER As Long = -2 'Note: On 
> last column, its width fills remaining width
> 
>                                             'of list-view 
> according to Micro$oft. This does not
> 
>                                             'appear to be the 
> case when I do it.
> 
> 
> 
> 
> 
> 'Auto Size Column
> 
> Public Sub AutoSizeColumnLv(lv As ListView)
> 
> Dim ii As Integer
> 
> Dim szKey As String
> 
> Dim objItem As ListItem
> 
>     
> 
>     With lv
> 
>         szKey = CStr(Now)
> 
>         'frank_lupo add new element title in listview
> 
>         Set objItem = .ListItems.Add(1, szKey, 
> .ColumnHeaders(1).Text & "  ")
> 
>  
> 
> 
>   SendMessage .hWnd, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE
> 
>         For ii = 1 To .ColumnHeaders.Count - 1
> 
>             objItem.SubItems(ii) = .ColumnHeaders(ii + 1).Text & "  "
> 
>             SendMessage .hWnd, LVM_SETCOLUMNWIDTH, ii, LVSCW_AUTOSIZE
> 
>         Next
> 
>         'frank_lupo drop element title in listview
> 
>         .ListItems.Remove szKey
> 
>     End With
> 
> End Sub
> 
> 
> 
> Bye !!
> Frank Lupo (Wolf) !!
> 
>        /\_ _/\
>        \ o o /
> --ooo-----ooo---
> 
> 
> 
> 
> 
> --
> Prendi GRATIS l'email universale che... risparmia: 
http://www.email.it/f

Sponsor:
Tariffe promozionali per viaggiare in tutto il mondo, clicca e scopri
dove prenotare Clicca qui:
http://adv.email.it/cgi-bin/foclick.cgi?mid=1258&d=10-2

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to