Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listview and maximizing the form window

Status
Not open for further replies.

Antithott

IS-IT--Management
Jan 20, 2006
90
DK
Hi.

Im wondering if anyone have a good idea or know how i can have the listview item, automatickly expand the colums so it fit the listview windows if i maximize the form window.

Atm i do it in the form event, and have hardcoded the colums sizes in, but it doesnt work for diffrent screen sizes,
 
Why not using the ANCHOR PROPERTY?

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
I do use the ANCHOR properties.

But it wont resize the colums, becuase they get a defined width from the colum properties. Atleast thats what i have found trying to get it to work
 
This is one of the old approach
Code:
    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        If Me.WindowState = FormWindowState.Minimized Then
            Exit Sub
        Else
            With Me.ListView1
                .Columns(0).Width = Me.ListView1.Width / 2
                .Columns(1).Width = Me.ListView1.Width / 4
            End With
        End If
    End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top