|
-
Jun 12th, 2006, 06:59 PM
#1
Thread Starter
Frenzied Member
[2005] scan pc for bitmaps and store in imagelist?
well here is wat i want to do.
make my program scan for .bmp's and if it finds one it checks if its alrdy in the imagelist1 and if its not then it adds it. now my only problem is checking if the bmp is in the imagelist1. how would i do this? and make it fast?
-
Jun 12th, 2006, 07:35 PM
#2
Re: [2005] scan pc for bitmaps and store in imagelist?
Unless you visit the same file twice how can the same image already be in the ImageList? If you mean that there may be two copies of the same image in the file system then you'd have to compare either pixels or bytes of the current image to all images already in the collection. There's no way to make that genuinely fast that I'm aware of. I'd think the thing to do would be to simply add every image and if the user finds that they have duplicates because they had duplicates on their disc then let them remove them.
-
Jun 12th, 2006, 07:39 PM
#3
Re: [2005] scan pc for bitmaps and store in imagelist?
VB Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For Each iFile As String In IO.Directory.GetFiles("C:\Documents and Settings\Name\Desktop")
If IO.Path.GetExtension(iFile) = ".gif" AndAlso AlreadyImage(iFile) = False Then
ImageList1.Images.Add(iFile, New Bitmap(iFile))
End If
Next
End Sub
Private Function AlreadyImage(ByVal Picture As String) As Boolean
Dim tPic As New Bitmap(Picture)
For Each Item As String In ImageList1.Images.Keys
Dim MyPic As New Bitmap(Item)
If MyPic.GetPixel(MyPic.Width - 1, MyPic.Height - 1) = tPic.GetPixel(tPic.Width - 1, tPic.Height - 1) Then
Return True
End If
Next
End Function
End Class
If someone has an actual way with the imagelist please post, I cannot figure it out.
-
Jun 12th, 2006, 07:56 PM
#4
Thread Starter
Frenzied Member
Re: [2005] scan pc for bitmaps and store in imagelist?
 Originally Posted by jmcilhinney
Unless you visit the same file twice how can the same image already be in the ImageList? If you mean that there may be two copies of the same image in the file system then you'd have to compare either pixels or bytes of the current image to all images already in the collection. There's no way to make that genuinely fast that I'm aware of. I'd think the thing to do would be to simply add every image and if the user finds that they have duplicates because they had duplicates on their disc then let them remove them.
well im making a program to get and display every single file icon. thats y i dont want them added twice.
-
Jun 13th, 2006, 03:55 AM
#5
Addicted Member
Re: [2005] scan pc for bitmaps and store in imagelist?
what all tools should be added?
-
Jun 13th, 2006, 04:28 AM
#6
Hyperactive Member
Re: [2005] scan pc for bitmaps and store in imagelist?
if u want to collect the icons of all type of files exists on the HDD, then it's easy ..
If Not ImageList1.Images.ContainsKey(fileExtension) Then
ImageList1.Images.Add(fileExtension,Icon.ExtractAssociatedIcon(filePath).ToBitmap)
End If
I am using .NET 2010 with Windows 7
-
Jun 13th, 2006, 04:42 AM
#7
Re: [2005] scan pc for bitmaps and store in imagelist?
Scanning for BMP files isn't going to get you any icons. They are not related. Are you saying that you want to get all the file type icons in use on your machine or every ICO file or what? Just like for the BMPs, just because two icons look the same doesn't make them the same icon. You'd still have to do a pixel by pixel comparison. Don't forget also that ICO files can contain more than one icon, plus you also have ICL files, which can contain multiple sets of multiple icons.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|