473,837 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display .jpg thumbnails in ListView

Hi,

I'm struggling to create an app that contains a window showing thumbnails of
all. jpg files within a specified directory.
I've been a couple of examples of how to iterate through a directory and
extract thumbnails from each jpg file but nothing about what should happen
to the extracted thumbnail. Ideally I would like each thumbnail to be
displayed (with filename underneath each thumbnail) in a listview control
(large icon view).

I have a very old VB6 app that does this (by using an imagelist control to
hold the thumbnail info) but it's not the fastest app, doesn't compile in
..NET so ideally I'd like a VB.NET version.

Any help much appreciated

Cheers,
Paul
Nov 21 '05 #1
8 20283
I know about the C# Thumbnail Extractor on vbaccelerator.c om but I don't
know how to program in C# and the C# to VB.NET convertors produce tons of
errors.

"Paul" <pr*****@privat e.com> wrote in message
news:E9******** ************@pi pex.net...
Hi,

I'm struggling to create an app that contains a window showing thumbnails
of all. jpg files within a specified directory.
I've been a couple of examples of how to iterate through a directory and
extract thumbnails from each jpg file but nothing about what should happen
to the extracted thumbnail. Ideally I would like each thumbnail to be
displayed (with filename underneath each thumbnail) in a listview control
(large icon view).

I have a very old VB6 app that does this (by using an imagelist control to
hold the thumbnail info) but it's not the fastest app, doesn't compile in
.NET so ideally I'd like a VB.NET version.

Any help much appreciated

Cheers,
Paul

Nov 21 '05 #2
"Paul" <pr*****@privat e.com> schrieb:
I know about the C# Thumbnail Extractor on vbaccelerator.c om but I don't
know how to program in C# and the C# to VB.NET convertors produce tons of
errors.


You may want to keep the implementation of the Thumbnail Extractor in C#,
build a class library and use this class library in your VB.NET project.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
"Paul" <pr*****@privat e.com> schrieb:
I know about the C# Thumbnail Extractor on vbaccelerator.c om but I don't
know how to program in C# and the C# to VB.NET convertors produce tons of
errors.


You may want to keep the implementation of the Thumbnail Extractor in C#,
build a class library and use this class library in your VB.NET project.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
Thanks,
I still have the C# Project, how would I build a class library to use in my
VB.NET project?

Cheers,
Paul


"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:O7******** *****@TK2MSFTNG P12.phx.gbl...
"Paul" <pr*****@privat e.com> schrieb:
I know about the C# Thumbnail Extractor on vbaccelerator.c om but I don't
know how to program in C# and the C# to VB.NET convertors produce tons of
errors.


You may want to keep the implementation of the Thumbnail Extractor in C#,
build a class library and use this class library in your VB.NET project.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
Thanks,
I still have the C# Project, how would I build a class library to use in my
VB.NET project?

Cheers,
Paul


"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:O7******** *****@TK2MSFTNG P12.phx.gbl...
"Paul" <pr*****@privat e.com> schrieb:
I know about the C# Thumbnail Extractor on vbaccelerator.c om but I don't
know how to program in C# and the C# to VB.NET convertors produce tons of
errors.


You may want to keep the implementation of the Thumbnail Extractor in C#,
build a class library and use this class library in your VB.NET project.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6
"Paul" <pr*****@privat e.com> schrieb:
I still have the C# Project, how would I build a class library to use in
my VB.NET project?


Add the C# project to the solution that contains the VB.NET project. Make
sure that the C# project is a class library project (the project type can be
changed in the project properties). Then you can add a project reference to
the C# project in your VB.NET project. To do this, select the project in
the solution explorer, choose "Add/Remove reference..." from its context
menu and select the C# project on the "Projects" tab.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7
"Paul" <pr*****@privat e.com> schrieb:
I still have the C# Project, how would I build a class library to use in
my VB.NET project?


Add the C# project to the solution that contains the VB.NET project. Make
sure that the C# project is a class library project (the project type can be
changed in the project properties). Then you can add a project reference to
the C# project in your VB.NET project. To do this, select the project in
the solution explorer, choose "Add/Remove reference..." from its context
menu and select the C# project on the "Projects" tab.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #8
Ok, i added the project to the solution and added the reference but on
second thought I think the C# Thumbnail Extractor is overkill for my needs.
I only need .jpg thumbs not excel and word ones, plus I can't for the life
of me figure out how to use the routines from the C# project in my VB.NET
project. Not smart enough!

I have however found new code which does pretty much what I want.
Pasted below for everyone's advantage.

Start with a blank form, add a listview control and imagelist control. One
thing I am stuck on is the thumbnails are 'stretched' to fit the dimensions
specified (120,120).
I need to keep within 120x120 but keep the aspect ratio intact, in other
words keep the proportions. The other task I need help with is ensuring
that when a thumbnail or multiple thumbnails are selected, then deleted,
that the listview is updated and refreshed preferably without rebuilding the
entire imagelist!

Any ideas?

Cheers,
Paul
CODE START

Const IMAGE_DIRECTORY As String = "INSERT PATH TO JPGs HERE"
Dim files As String() = Directory.GetFi les(IMAGE_DIREC TORY)
Dim max_length, i As Integer
Dim s, fname As String

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
ImageList_Load( )
ListView_Load()
'Me.Controls.Ad dRange(New Control() {listView1})
End Sub

Private Sub ImageList_Load( )
Dim pname As String
Dim myImage As Image
'Set the ColorDepth and ImageSize properties of imageList1.
imageList1.Colo rDepth = ColorDepth.Dept h32Bit
imageList1.Imag eSize = New System.Drawing. Size(120, 120)
max_length = files.Length - 2
'Add images to imageList1.
For i = 0 To max_length
pname = Path.GetFullPat h(files(i))
myImage = Image.FromFile( pname)
imageList1.Imag es.Add(myImage)
myImage = Nothing
Next
pname = Nothing
End Sub

Private Sub ListView_Load()
'ListView1.View = View.LargeIcon
ListView1.Large ImageList = imageList1
For i = 0 To files.Length - 2
fname = Path.GetFileNam e(files(i))
Dim listViewItem1 As ListViewItem = New ListViewItem(fn ame, i)
'Add listViewItem1 and listViewItem2.
ListView1.Items .AddRange(New ListViewItem() {listViewItem1} )
listViewItem1 = Nothing
Next
End Sub

CODE END

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
"Paul" <pr*****@privat e.com> schrieb:
I still have the C# Project, how would I build a class library to use in
my VB.NET project?


Add the C# project to the solution that contains the VB.NET project. Make
sure that the C# project is a class library project (the project type can
be changed in the project properties). Then you can add a project
reference to the C# project in your VB.NET project. To do this, select
the project in the solution explorer, choose "Add/Remove reference..."
from its context menu and select the C# project on the "Projects" tab.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1497
by: Richard | last post by:
Hello. In VB .NET I have a class derived from ListView like this: Public Class ListViewSorted Inherits System.Windows.Forms.ListView 'code to make this ListViewSorted class sortable... End Class (this class belongs in a project of type component class)
3
10671
by: RAllsopp | last post by:
I have a client who would like to have several pictures associated with one system. I have read about storing only the pathname to save OLE overhead and have set-up a form for my client to browse/add one picture at a time to a system. Now he would like to 'view' all of the thumbnails associated with any system on a single form. I can setup a main/subform scenario, but how do I show all of the pictures as thumbnails. I was using the...
3
2821
by: andrewcw | last post by:
I have a simple winform with the following code. But although I can read back the info, the display fails to provide the text or the cell background color changes. private void ListViewBroke() { listView.View = View.Details; ArrayList LVcolTitles= new ArrayList(); LVcolTitles.Add("Drive"); LVcolTitles.Add("Cust");
3
11404
by: Vagabond Software | last post by:
I'm trying to display thumbnail images in a Listview that look more like the Windows thumbnail view. Everything is working pretty good, but my thumbnails are decidedly not like the Windows thumbnails. View the following snapshot to compare the Windows thumbnails (top) to my ListView thumbnails (bottom): http://home.san.rr.com/vagabondia/images/tmp/sample.gif It looks like the Windows thumbnails retain their proportion by, perhaps,
3
2526
by: WStoreyII | last post by:
i need a control (free) that can be used to display thumbnails of pictures like they are in explorer. What control can do this? Thanks WStoreyII
1
587
by: Paul | last post by:
Hi, I'm struggling to create an app that contains a window showing thumbnails of all. jpg files within a specified directory. I've been a couple of examples of how to iterate through a directory and extract thumbnails from each jpg file but nothing about what should happen to the extracted thumbnail. Ideally I would like each thumbnail to be displayed (with filename underneath each thumbnail) in a listview control (large icon view).
0
1554
by: twoSeven | last post by:
hi, Here is what i want to do. I am making a file and folder browser similar to Windows Explorer with a treeview and listview.. In that, i get icons and thumbnails of a particular file/folder from a function(getMyIcon()) which interacts with shell to get icons and updates the two imagelists( for small and large icons).this in turn is used to update a listview to show the file/folder name and the icons. The problem is the UI becomes...
0
1233
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I have an WinForms application, and I am currently trying to load a TIFF file that contains about 70, 90 o more frames and show it in my form like thumbnails. Once I have the file loaded (I don't know if I load it into an Image object (Image.FromFile()).
3
2125
by: Tim Kelley | last post by:
Is there a way (command line switch) to open Windows Explorer and set the view to Thumbnails? Thanks, Tim
0
9827
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9678
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10263
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6987
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5838
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4468
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4034
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3120
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.