Click here to Skip to main content
15,891,682 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I want to change ImageList image size while Listview is active and contains items?
any help will be appreciated.
thanks
Posted
Comments
Sandeep Mewara 8-Jul-12 8:19am    
How is imagelist connected to listview here?
Your question has lots of missing details! Start with related code snippet.

Use the "Improve question" link to edit your question and provide better information.
Ganesan Senthilvel 8-Jul-12 10:06am    
Code reference will be helpful
Leecherman 9-Jul-12 0:02am    
OK here is the code:

[code]

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each fileName As String In IO.Directory.GetFiles("C:\")
ImageList1.Images.Add(Icon.ExtractAssociatedIcon(fileName))
ListView1.Items.Add(IO.Path.GetFileName(fileName), ImageList1.Images.Count - 1)
Next
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim OpenFile As New OpenFileDialog
With OpenFile
.Multiselect = True
If .ShowDialog = Windows.Forms.DialogResult.OK Then
For Each fileName As String In .FileNames
ImageList1.Images.Add(Icon.ExtractAssociatedIcon(fileName))
ListView1.Items.Add(IO.Path.GetFileName(fileName), ImageList1.Images.Count - 1)
Next
End If
End With
End Sub

Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
If Me.TrackBar1.Value = 0 Then
ImageList1.ImageSize = New Size(16, 16)
ElseIf Me.TrackBar1.Value = 1 Then
ImageList1.ImageSize = New Size(20, 20)
ElseIf Me.TrackBar1.Value = 2 Then
ImageList1.ImageSize = New Size(24, 24)
ElseIf Me.TrackBar1.Value = 3 Then
ImageList1.ImageSize = New Size(32, 32)
End If
End Sub

[/code]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900