-
Mar 27th, 2017, 02:08 PM
#1
Thread Starter
Registered User
Creating a Photo Reel-like control
Hello peeps. I need some advices on how to make a photo reel-like user control for a security booth environment.
What I currently have is a dgv with registered people, in which one of the columns is the filename of the person's photo, stored locally, as jpeg.
I've also made a user control consisting of a single-row table with about 15 columns, a panel on each column, named Photo1, Photo2, and so on, and I've placed that control on the main form.
My intention was to iterate through each datagridview.row, read each row's "Filename" column, and iterate each through each panel on the user control, assigning background images for each panel according to each filename read.
Is that a good approach, or do you have any other suggestions?
-
Mar 27th, 2017, 05:57 PM
#2
Re: Creating a Photo Reel-like control
Don't use Panels and BackgroundImages. Use the control that was made for displaying images, i.e. the PictureBox.
-
Mar 28th, 2017, 08:34 PM
#3
Re: Creating a Photo Reel-like control
Well..
To get completely started you will want to make sure you use a control like suggested above appropriate for photos.
I suggest taking advantage of using a background image.
For a literal interpatation I drew you a picture - using a Background image that repeats itself (Using the Tile Setting) All you have to do is add the image as teh background image and it will do the rest. I used the entire form, but you can use a panel or do the same whatever floats your boat.
Explaination of what I did:
I set the reel image as the background on tile, I resized it so you can see the repeat. I added a picture box and put in the white space area and placed a image inside it.
I think this was kinda what you were talking about without the fancy stuff.
Hope it gives a little inspiration...
P.s. the panels I mentioned earlier is for the background image ONLY - and should only be used if you need to put other stuff on the same form.
Also you can use the other white area for a label or whatever with the name of the person or file path or whatever it is you was wanting to do...
Here is the results.
Here is what image I used:
Disclaimer: When code is given for example - it is merely a example. •
•
•
Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.
-
Mar 28th, 2017, 09:37 PM
#4
Re: Creating a Photo Reel-like control
Do either of those replies answer your question?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 29th, 2017, 01:39 PM
#5
Thread Starter
Registered User
Re: Creating a Photo Reel-like control
Ah, I didn't express myself correctly. By "photoreel" I meant a control that I can add pictures to it and display their thumbnails, which can be clicked, taking the user to its respective page. This is what I'm working on:
However, right now my code iterates through the entries on the dgv, and placing images on the panels (which I'm changing to pictureboxes as jmc pointed out) until it throws a silent (internal) "file not found" exception, when it exits the sub and the end user is none the wiser.
I'd like to know a better way to populate that user control with people's portraits. Even better, if it only placed enough pictureboxes to hold the portraits, without overflowing the window unnecessarily with empty portrait slots (the way it is now).
-
Mar 29th, 2017, 01:46 PM
#6
Re: Creating a Photo Reel-like control
You just need to loop through your dgv rows, use an if statement to determine if there is a filename, then create a picturebox, add it to your user control and load the picture.
Google adding controls at runtime
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 29th, 2017, 03:08 PM
#7
Thread Starter
Registered User
Re: Creating a Photo Reel-like control
Originally Posted by .paul.
You just need to loop through your dgv rows, use an if statement to determine if there is a filename, then create a picturebox, add it to your user control and load the picture.
Google adding controls at runtime
Thanks! I'll try this as soon as I get home.
EDIT.: Yes, it seems this will work perfectly. Thanks for the assistance.
Last edited by Tucalipe; Mar 29th, 2017 at 04:05 PM.
-
Mar 29th, 2017, 05:51 PM
#8
Re: Creating a Photo Reel-like control
Ya, you didn't give any explaination So I didn't know what you wanted.
I see you found a solution, be sure to Mark The Thread as resolved (Thread Tools drop down > Mark Resolved) ... Just to go over the last few posts:
In reply to Paul's reply.
You can add controls at runtime by doing it any other time you create a control.
I use controls created at time its needed all the time, quite simply it reduces clutter in the UI.
(For Reference you can see here)
Code:
Dim C as new Control 'Whatever you wanna create
Me.Controls.Add(C)
You can also size the control and such, but note to do it after you create the control otherwise it may cause a error.
Disclaimer: When code is given for example - it is merely a example. •
•
•
Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.
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
|