Results 1 to 8 of 8

Thread: Creating a Photo Reel-like control

  1. #1

    Thread Starter
    Registered User
    Join Date
    Nov 2016
    Posts
    51

    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?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    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.

  3. #3
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,168

    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.
    Name:  Photo Reel Results.jpg
Views: 110
Size:  25.4 KB

    Here is what image I used:
    Name:  Image-Reel.png
Views: 112
Size:  1.2 KB
    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.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Creating a Photo Reel-like control

    Do either of those replies answer your question?

  5. #5

    Thread Starter
    Registered User
    Join Date
    Nov 2016
    Posts
    51

    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).

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    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

  7. #7

    Thread Starter
    Registered User
    Join Date
    Nov 2016
    Posts
    51

    Re: Creating a Photo Reel-like control

    Quote Originally Posted by .paul. View Post
    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.

  8. #8
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,168

    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
  •  



Click Here to Expand Forum to Full Width