By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

create dynamic thumbnails on form or pannel using a picturebox?

P: n/a
Hello,

I want to simulate the dynamic thumbnail display of Windows Explorer (winxp)
on a form or pannel container. If I place a picture box on my container
form/pannel and dimension it to the size of a thumbnail and set the sizemode
to Stretch -- I get one thumbnail. I want to retrieve all the picture files
(jpg, bmp) in a directory into an array list and then display this list as
thumbnails on my form dynamically. So my question is "how do I create
thumbnails on the fly"? I am thinking - copy the picturebox at runtime as
many times as I need. Am I on the right track here? Or is there a more
efficient/correct way to do this? If I have to copy the picturebox at
runtime - how is this accomplished?

Thanks,
Rich
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Would a datagrid be an option? I could create the datagrid on the fly and
have an image column(s). Any suggestions appreciated.

"Rich" wrote:
Hello,

I want to simulate the dynamic thumbnail display of Windows Explorer (winxp)
on a form or pannel container. If I place a picture box on my container
form/pannel and dimension it to the size of a thumbnail and set the sizemode
to Stretch -- I get one thumbnail. I want to retrieve all the picture files
(jpg, bmp) in a directory into an array list and then display this list as
thumbnails on my form dynamically. So my question is "how do I create
thumbnails on the fly"? I am thinking - copy the picturebox at runtime as
many times as I need. Am I on the right track here? Or is there a more
efficient/correct way to do this? If I have to copy the picturebox at
runtime - how is this accomplished?

Thanks,
Rich

Nov 21 '05 #2

P: n/a
Not sure I understand exactly your question but you can create a thumbnail
image from an image using the GetThumNailImage method for Images;

'Assume MyImage is your image (bitmap, etc)
'Dim inp As New IntPtr
'Try
' If Height > 0 AndAlso Width > 0 Then
' MyThumbImage = myImage.GetThumbnailImage(Height, Width, Nothing, inp)
' Else
' Return Nothing
' End If
'Catch er As Exception
' Return Nothing
'End Try
'Convert to Bitmap if desired
'Return CType(MyThumbImage, Bitmap)
--
Dennis in Houston
"Rich" wrote:
Would a datagrid be an option? I could create the datagrid on the fly and
have an image column(s). Any suggestions appreciated.

"Rich" wrote:
Hello,

I want to simulate the dynamic thumbnail display of Windows Explorer (winxp)
on a form or pannel container. If I place a picture box on my container
form/pannel and dimension it to the size of a thumbnail and set the sizemode
to Stretch -- I get one thumbnail. I want to retrieve all the picture files
(jpg, bmp) in a directory into an array list and then display this list as
thumbnails on my form dynamically. So my question is "how do I create
thumbnails on the fly"? I am thinking - copy the picturebox at runtime as
many times as I need. Am I on the right track here? Or is there a more
efficient/correct way to do this? If I have to copy the picturebox at
runtime - how is this accomplished?

Thanks,
Rich

Nov 21 '05 #3

P: n/a
Thanks for your reply. Yes, I did find a sample of the code you show for
creating a thumbnail in a picturebox control. What I want to do is to
display multiple thumbnails in a container like a form or pannel - similar to
Windows Explorer when you select View Thumbnails for a list of jpg or bmp
files in a directory. Is it possible to dynamically create multiple picture
boxes on a form/pannel at run time? How is this accomplished? For example,
I retrieve a list of jpg/bmp files from a directory into an arraylist. Say
there are 5 picture files. I want to display all 5 pictures as thumbnails on
my container. Then say I retrieve a list of picture files from another
directory - say 20 pictures. I want to display those 20 pictures as
thumbnails on my form/pannel.

Thanks,
Rich

"Dennis" wrote:
Not sure I understand exactly your question but you can create a thumbnail
image from an image using the GetThumNailImage method for Images;

'Assume MyImage is your image (bitmap, etc)
'Dim inp As New IntPtr
'Try
' If Height > 0 AndAlso Width > 0 Then
' MyThumbImage = myImage.GetThumbnailImage(Height, Width, Nothing, inp)
' Else
' Return Nothing
' End If
'Catch er As Exception
' Return Nothing
'End Try
'Convert to Bitmap if desired
'Return CType(MyThumbImage, Bitmap)
--
Dennis in Houston
"Rich" wrote:
Would a datagrid be an option? I could create the datagrid on the fly and
have an image column(s). Any suggestions appreciated.

"Rich" wrote:
Hello,

I want to simulate the dynamic thumbnail display of Windows Explorer (winxp)
on a form or pannel container. If I place a picture box on my container
form/pannel and dimension it to the size of a thumbnail and set the sizemode
to Stretch -- I get one thumbnail. I want to retrieve all the picture files
(jpg, bmp) in a directory into an array list and then display this list as
thumbnails on my form dynamically. So my question is "how do I create
thumbnails on the fly"? I am thinking - copy the picturebox at runtime as
many times as I need. Am I on the right track here? Or is there a more
efficient/correct way to do this? If I have to copy the picturebox at
runtime - how is this accomplished?

Thanks,
Rich

Nov 21 '05 #4

P: n/a
Rich wrote:
Thanks for your reply. Yes, I did find a sample of the code you show for
creating a thumbnail in a picturebox control. What I want to do is to
display multiple thumbnails in a container like a form or pannel - similar to
Windows Explorer when you select View Thumbnails for a list of jpg or bmp
files in a directory. Is it possible to dynamically create multiple picture
boxes on a form/pannel at run time? How is this accomplished? For example,
I retrieve a list of jpg/bmp files from a directory into an arraylist. Say
there are 5 picture files. I want to display all 5 pictures as thumbnails on
my container. Then say I retrieve a list of picture files from another
directory - say 20 pictures. I want to display those 20 pictures as
thumbnails on my form/pannel.

Thanks,
Rich


This link might be helpful to you http://tinyurl.com/cfds2.
Nov 21 '05 #5

P: n/a
Thanks. That was a useful example. I will have to study it for a while to
see if I can incorporate (figure out how the controls are created) it into my
app.

Thanks again,
Rich

"Mark" wrote:
Rich wrote:
Thanks for your reply. Yes, I did find a sample of the code you show for
creating a thumbnail in a picturebox control. What I want to do is to
display multiple thumbnails in a container like a form or pannel - similar to
Windows Explorer when you select View Thumbnails for a list of jpg or bmp
files in a directory. Is it possible to dynamically create multiple picture
boxes on a form/pannel at run time? How is this accomplished? For example,
I retrieve a list of jpg/bmp files from a directory into an arraylist. Say
there are 5 picture files. I want to display all 5 pictures as thumbnails on
my container. Then say I retrieve a list of picture files from another
directory - say 20 pictures. I want to display those 20 pictures as
thumbnails on my form/pannel.

Thanks,
Rich


This link might be helpful to you http://tinyurl.com/cfds2.

Nov 21 '05 #6

P: n/a
You can either create the picture boxes on your form at design time then set
the visible property to True for the ones you want to show or you can create
and dispose of them at designtime; To create a picture box at run time;

dim pic1 as new PIctureBox
Me.Controls.Add(pic1)
pic1.Width = xxx
pic1.Height = xxx
pic1.Top=xxx
pic1.Left = yyy
--
Dennis in Houston
"Rich" wrote:
Thanks for your reply. Yes, I did find a sample of the code you show for
creating a thumbnail in a picturebox control. What I want to do is to
display multiple thumbnails in a container like a form or pannel - similar to
Windows Explorer when you select View Thumbnails for a list of jpg or bmp
files in a directory. Is it possible to dynamically create multiple picture
boxes on a form/pannel at run time? How is this accomplished? For example,
I retrieve a list of jpg/bmp files from a directory into an arraylist. Say
there are 5 picture files. I want to display all 5 pictures as thumbnails on
my container. Then say I retrieve a list of picture files from another
directory - say 20 pictures. I want to display those 20 pictures as
thumbnails on my form/pannel.

Thanks,
Rich

"Dennis" wrote:
Not sure I understand exactly your question but you can create a thumbnail
image from an image using the GetThumNailImage method for Images;

'Assume MyImage is your image (bitmap, etc)
'Dim inp As New IntPtr
'Try
' If Height > 0 AndAlso Width > 0 Then
' MyThumbImage = myImage.GetThumbnailImage(Height, Width, Nothing, inp)
' Else
' Return Nothing
' End If
'Catch er As Exception
' Return Nothing
'End Try
'Convert to Bitmap if desired
'Return CType(MyThumbImage, Bitmap)
--
Dennis in Houston
"Rich" wrote:
Would a datagrid be an option? I could create the datagrid on the fly and
have an image column(s). Any suggestions appreciated.

"Rich" wrote:

> Hello,
>
> I want to simulate the dynamic thumbnail display of Windows Explorer (winxp)
> on a form or pannel container. If I place a picture box on my container
> form/pannel and dimension it to the size of a thumbnail and set the sizemode
> to Stretch -- I get one thumbnail. I want to retrieve all the picture files
> (jpg, bmp) in a directory into an array list and then display this list as
> thumbnails on my form dynamically. So my question is "how do I create
> thumbnails on the fly"? I am thinking - copy the picturebox at runtime as
> many times as I need. Am I on the right track here? Or is there a more
> efficient/correct way to do this? If I have to copy the picturebox at
> runtime - how is this accomplished?
>
> Thanks,
> Rich

Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.