displaying thumbnailview of files inside a folder

hi,
Is there any control avilable for displaying "thumbnail view" of all the files inside a folder in C# application.
If it is not there, how to implement that one and which is the best algorithm.

thanks in advance,
Singam

[237 byte] By [singam] at [2007-12-22]
# 1
If these files are image files, just use the PictureBox control and the Image.FromFile() method to load the images...
nobugz at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2

The code to create a thumbnail for an image is simple: http://abstractvb.com/code.asp?A=1016

You will find infor to create a thumbnail for any file here (it's a vb6 site) : http://www.vbaccelerator.com/home/vb/Code/Libraries/Shell_Projects/Thumbnail_Extraction/article.asp

papadi at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
thanks for your reply.
Actually i tried to simulate the thumbnail view in the microsoft picture manager.
With the zoom-in and zoom-out
Zoom-in: it makes the thumbnail view into smaller and increase the no of thumbnail pictures in the row. If i zoom out , it increase the size of the individual picture and decrease the no of thumbnail picture in the top row and bring the remaining the pictures in the next row.

I tried to do the similar thing which is in "Microsoft picture manager".
I tried with dock properties,its not working. Suggest me how to do that?

Question is:
1. Do i need to use good logic?
2.Is there any control available for displaying the list.

Any help is appreciated.

thanks,
Singam

singam at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 4
Here's

some sample VB.NET code to get you started. Drop a Toolstrip and

FolderBrowseDialog control on your form. Drop a Panel control and

set its Dock property to Fill and AutoScroll to True. Hope it

helps...

Public Class Form1

Private supportedExt() As String = {".BMP", ".JPG", ".JPEG", ".PNG", ".GIF", ".TIF", ".TIFF", ".EMF", ".WMF", ".ICO"}

Dim mPictures As New List(Of PictureBox)

Dim mZoom As Integer = 5

Public Sub SetFolder(ByVal path As String)

' Remove old pictureboxes

For Each pic As PictureBox In mPictures

Me.Panel1.Controls.Remove(pic)

pic.Dispose()

Next

mPictures.Clear()

' Read folder for new pictures

Dim files() As String = System.IO.Directory.GetFiles(path)

For Each file As String In files

Dim ext As String = System.IO.Path.GetExtension(file).ToUpper

If Array.IndexOf(supportedExt, ext) >= 0 Then

Try

Dim pic As New PictureBox

pic.Image = Bitmap.FromFile(file)

pic.SizeMode = PictureBoxSizeMode.Zoom

mPictures.Add(pic)

Me.Panel1.Controls.Add(pic)

Catch ex As Exception

Debug.Print(ex.Message)

End Try

End If

Next

arrangeView()

End Sub

Public Property Zoom() As Integer

Get

Return mZoom

End Get

Set(ByVal value As Integer)

If value > 0 Then mZoom = value

arrangeView()

End Set

End Property

Private Sub arrangeView()

' Calculate picture width and make aspect 3:4

Dim w As Integer = Me.Panel1.ClientSize.Width \ mZoom

Dim h As Integer = 4 * w \ 3

Dim ix As Integer = 0

Me.Panel1.AutoScrollPosition = New Point(0, 0)

Me.Panel1.SuspendLayout()

For hx As Integer = 0 To 99999 Step h

For wx As Integer = 0 To mZoom - 1

If ix >= mPictures.Count Then GoTo quit

With mPictures(ix)

.Left = wx * w

.Top = hx

.Width = w

.Height = h

ix += 1

End With

Next

Next

quit:

Me.Panel1.ResumeLayout()

End Sub

Private Sub Form1_ResizeEnd(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ResizeEnd

arrangeView()

End Sub

Private Sub btnZoomUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoomUp.Click

Zoom = Zoom - 1

End Sub

Private Sub btnZoomDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoomDown.Click

Zoom = Zoom + 1

End Sub

Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click

If FolderBrowserDialog1.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then

SetFolder(FolderBrowserDialog1.SelectedPath)

End If

End Sub

End Class

nobugz at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 5

Hello friends

I am having the same issue as above when i load 500 images it takes lots of time to load and the zoom effect starts flickering. while zooming i would like to zoom the panel background image with zoom of the images. Can some body help me out . Thanks in advance

Atheeque

SyedAtheequePasha at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 6
I created this example to see how it works. How would one get a better quality image using this example? And also, to zoom up for more detail in the maximum zoom level allowed?
TareyWolf at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified