Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Explorer-Style ListView

Explorer-Style ListView

Scheduled Pinned Locked Moved Visual Basic
graphicsquestionannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brad Fackrell
    wrote on last edited by
    #1

    I have an Explorer-Style ListView and I use ListView1.View = View.Details ListView1.View = View.LargeIcon ListView1.View = View.List ListView1.View = View.SmallIcon to update the respective view. I added the ability to view thumbnails with this code:

        Dim fullPath As String
        Dim di As New DirectoryInfo(fpath)
        Dim fi As FileInfo
        Dim i As Integer
    
        fullPath = GetPathFromNode(TreeView1.SelectedNode)
        ListView1.Items.Clear()
    
        '\*\*\* Loop to get the "jpg" files
        Try
            For Each fi In di.GetFiles("\*.jpg") ' if path will contain link files, change from jpg to lnk
                ImageList3.ImageSize = New Size(96, 96)
                Try
                    CreateThumbNail(fpath & "\\" & fi.Name) ' This returns the thumbnail images
    
                    With ListView1 ' set the properties for for the ListView ListView1
                        .Items.Add(fi.Name, i)
                        .LargeImageList = ImageList3
                        .ForeColor = Color.Blue
                        .Scrollable = True
                    End With
                Catch
                    Exit Try
                End Try
    
                i += 1
            Next ' cycle through fpath until no more \*.jpg.lnk files are found
        Catch
            MsgBox("No image files are located in this directory.", MsgBoxStyle.Exclamation, "Thumbnails")
            Exit Try
        End Try
    
    Private Sub CreateThumbNail(ByVal filepath As String)
        Dim myImage As New Bitmap(filepath)
        Dim MyThumbNail As Image
        '\*\*\* ThumbNail
        MyThumbNail = myImage.GetThumbnailImage(96, 96, AddressOf Thumbnailabort, Nothing)
        '\*\*\* Fill the ImageList with Image Collection
        ImageList3.Images.Add(MyThumbNail)
    End Sub
    

    The four ListView1.View = * work just fine until I execute the routine to view thumbnails. After viewing thumbnails the four ListView1.View = * routines do not work properly. Among the problems is that only jpg’s are listed in the ListView. Any ideas or suggestions? Thanks Brad

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups