Results 1 to 7 of 7

Thread: Suggestions on a picture box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    74
    I got a picture box that changes the picture it displays from time to time in the program. I use the load picture method. Now I don't really have problems it's just that how can I prevent users from editing or deleting the pictures that the picture box uses? I just want to prevent them from tampering with the look of the program. Is using several picture boxed and showing and hiding them more pratical and efficient?

    What do you guys think?


  2. #2
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    If you don't have many pictures, having a PictureBox for each one on the form and hiding/showing them as needed will work. If you have more than what would be efficient to show, use an ImageList object. Then you can get by with a single PictureBox. In the Project menu, select Components (or press control+T), and select Microsoft Common Controls 5.0. I use Win95, and that's the control set with ImageList. In higher Win versions, I think it might be 6.0. Stick one in, and then in the Custom part on the Properties window, add the pictures into the control. Then in the event that triggers a new picture, do this:
    Code:
    Picture1.Picture = ImageList1.ListImages(Index).Picture
    If you had 5 bitmaps loaded into it, Index would be from 1-5. You can also specify a key (just a string) for each image, and then you can use "key" instead of an index in the () to refer to a particular picture in the ImageList.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    74
    Hey great! Thanks Kaverin! That should solve the efficiency problem, but one question though, with the imagelist object do I still need the images if I transfer the program to another computer?
    What's the naming convention of imagelists? Just want to practice using standard naming conventions

    Again, thanks for the help!

    [Edited by gin on 10-14-2000 at 03:52 AM]

  4. #4
    Guest
    No, you do not need the original files. Once you load the images into the ImageList, they are stored in memory.

  5. #5
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    You're welcome. I'm not sure what the convention is for naming them. When I started using conventions, it was back when VB4 had just come out, and I don't think this control even existed. But since an Image control is img, and a ListBox is lst, I use either imglst, or ilst.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  6. #6
    Guest
    I'm not sure what naming conventions are, but if it's what I think it is (the prefix of the object name?) then...
    I used to use "il", but I just started using "iml" or "ilt" because the prefixes are usually 3 letters long.

    [Edited by Sc0rp on 10-14-2000 at 11:22 AM]

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    74

    Thanks

    Thanks again!

    I just used the iml hope other programmers who look at trhe code will understand

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