• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1492
  • Last Modified:

ListView resize

Greetings,

I have a listview control in Form1. I'd like to resize the listview (thus occupying the entire form in the left and right). Do I have to set the listview1.width and height in form_resize event?

Secondly, the listview does not occupy the entire form, and giving a ugly look in high resolution displays (leaving a white space in either side of the form).

thanks!
0
sramesh2k
Asked:
sramesh2k
  • 2
1 Solution
 
KarcOriginCommented:
Try this-

Option Explicit

Private Sub Form_Load()
    Call ResizeListView
End Sub

Private Sub ResizeListView()
    With ListView1
        .Top = 0
        .Left = 0
        .Width = Me.Width
        .Height = Me.Height
    End With
End Sub

Private Sub Form_Resize()
    Call ResizeListView
    DoEvents
End Sub

Thx
0
 
sramesh2kAuthor Commented:
Thanks, KarcOrigin!
0
 
sramesh2kAuthor Commented:
FYI:A slight alteration I did, as required:

--------------
If Me.WindowState <> vbMinimized Then
        ListView1.Left = 0
        ListView1.Top = Toolbar1.Height
        ListView1.Width = Me.ScaleWidth
        ListView1.Height = Me.ScaleHeight - Toolbar1.Height - StatusBar1.Height
End If
---------------
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now