471,594 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

create dynamic thumbnails on form or pannel using a picturebox?

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
6 4525
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
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
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
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
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
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.

Similar topics

3 posts views Thread by Bob Bedford | last post: by
3 posts views Thread by TheLostLeaf | last post: by
reply views Thread by Anwar ali | last post: by

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.