Results 1 to 11 of 11

Thread: (ask) picture album like windows explorer

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    33

    (ask) picture album like windows explorer

    how create photo album, i wonder to create like windows explorer with thumbnail folder (as category) when i perform click the show all my picture inside folder and show the name without extension just filename, i just try it with listview.. can anyone help me to figure this out..

    Name:  listview.png
Views: 305
Size:  192.3 KB
    Last edited by primadona; Jan 4th, 2013 at 01:22 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: (ask) picture album like windows explorer

    Thumbnails are easy to create with the Image.GetThumbnailImage method. Creating that 3D folder effect is something that I would not suggest trying in Windows Forms. If you want to do that sort of thing then you should use WPF from the get-go. WPF has a steep learning curve but, once you're comfortable with it, effects like that are relatively simple.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    33

    Re: (ask) picture album like windows explorer

    Quote Originally Posted by jmcilhinney View Post
    Thumbnails are easy to create with the Image.GetThumbnailImage method. Creating that 3D folder effect is something that I would not suggest trying in Windows Forms. If you want to do that sort of thing then you should use WPF from the get-go. WPF has a steep learning curve but, once you're comfortable with it, effects like that are relatively simple.
    hi jmcilhinney

    i just want create 1 photo as thumbnail so i dont need 3d, how to do that on vb?
    and the folder directory start with c:\photo will load all directory sub folder ex:
    c:\photo\vacation\ <-- when thumbnail click will load all image in news folder
    c:\photo\holiday\ <-- when thumbnail click will load all image in news folder
    c:\photo\news\ <-- when thumbnail click will load all image in news folder
    and etc

    any possible to do that ?

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    33

    Re: (ask) picture album like windows explorer

    Code:
          For Each i As String In Directory.GetFiles("C:\")
                ListView1.Items.Add(Path.GetFileName(i)) 'the Path is a separate class of the System.IO Namespace that allows you to perform operations based on path information - such as GetFileName
            Next
    why only files show up, how to make the folder show up in listview?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: (ask) picture album like windows explorer

    Um, you're calling GetFiles, so why would you expect to get anything besides files? If the Directory class has a GetFiles method to get files, don't you think that it should be fairly easy to answer your own question with a little bit of logic?

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    33

    Re: (ask) picture album like windows explorer

    Quote Originally Posted by jmcilhinney View Post
    Um, you're calling GetFiles, so why would you expect to get anything besides files? If the Directory class has a GetFiles method to get files, don't you think that it should be fairly easy to answer your own question with a little bit of logic?
    oh thank's for your correction;
    Code:
    GetFiles
    change with ;
    Code:
    Directory.GetDirectories
    can i load the thumbnail from random image inside the folder?

    idk why i'm very confuse with this project...

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: (ask) picture album like windows explorer

    Using purely managed code, to create a thumbnail, you must first load the file into an Image object and then call GetThumbnailImage. If you want a random file then you call GetFiles and choose a random element from that array.

  8. #8

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    33

    Re: (ask) picture album like windows explorer

    Quote Originally Posted by jmcilhinney View Post
    Using purely managed code, to create a thumbnail, you must first load the file into an Image object and then call GetThumbnailImage. If you want a random file then you call GetFiles and choose a random element from that array.
    can you give me sample code?

  9. #9

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    33

    Re: (ask) picture album like windows explorer

    i'm try with code like this, but the thumbnail still not appear
    Code:
    For Each f As String In System.IO.Directory.GetFiles("C:\", "*.jpg")
    
                Dim img As Image = New Bitmap(f)
    
                ImageList1.Images.Add(img.GetThumbnailImage(96, 96, Nothing, Nothing))
    
                ListView1.Items.Add(f, ImageList1.Images.Count - 1)
    
                img.Dispose()
    
            Next

  10. #10
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: (ask) picture album like windows explorer

    Have you set ListView1.LargeImageList = ImageList1 (in design or runtime)?
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  11. #11

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    33

    Re: (ask) picture album like windows explorer

    Quote Originally Posted by dunfiddlin View Post
    Have you set ListView1.LargeImageList = ImageList1 (in design or runtime)?
    in design

    when i run my form, the listview just show directory name and blank imagelist

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width