Jump to content




Recent Topics

Recent Status Updates

  • Photo
      26 Jul
    Kadence

    It's been so long since I've coded I actually don't feel like the same person anymore.

    Show comments (2)
View All Updates

Binpress - Cut your development time and costs in half
Photo
- - - - -

Image List


  • Please log in to reply
58 replies to this topic

#1 wazofski

wazofski

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 118 posts

Posted 28 July 2008 - 11:11 AM

How do I add Images to a listbox? So if you press the name in the listbox of the picture it will be shown in a picturebox
I use vb 2008
  • 0

#2 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8,356 posts

Posted 28 July 2008 - 11:23 AM

Aha. Use an ImageList. Add one to the project, then add the images using the Properties panel. Then, you can use code such as ImageList1.Images(0) to set to the picturebox's Image property.
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#3 wazofski

wazofski

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 118 posts

Posted 28 July 2008 - 11:29 AM

I got the imagelist, and could you tell more specific how to add the images to the list?
  • 0

#4 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8,356 posts

Posted 28 July 2008 - 11:30 AM

First, change the ImageSize or something named like that, to stop it resizing images. Then, click on the Images property, click the small button labelled "...", and add images from the window that appears.
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#5 wazofski

wazofski

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 118 posts

Posted 28 July 2008 - 11:38 AM

ok and how do I add the image to the picturebox?
  • 0

#6 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8,356 posts

Posted 28 July 2008 - 11:47 AM

Well, like this:


Dim index As Integer = 2
PictureBox1.Image = ImageList1.Images(index)


This code sets the third image in the list to the picturebox (because arrays are zero-based).
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#7 wazofski

wazofski

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 118 posts

Posted 28 July 2008 - 11:51 AM

thx, one more problem the imagelist resizes the images how do i turn it off?
  • 0

#8 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8,356 posts

Posted 28 July 2008 - 11:52 AM

Yeah, I get that sometimes. Did you set the ImageSize property first on the ImageList?
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#9 wazofski

wazofski

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 118 posts

Posted 28 July 2008 - 11:55 AM

The image size was automaticly set on 32;32 (image list)
  • 0

#10 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8,356 posts

Posted 28 July 2008 - 11:56 AM

That's what happens to me! What about the property of the ImageList? Did you try changing that, then adding the images?
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#11 wazofski

wazofski

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 118 posts

Posted 28 July 2008 - 12:01 PM

I really dont know how to change it actually
  • 0

#12 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8,356 posts

Posted 28 July 2008 - 12:03 PM

1) Click on the ImageList at the bottom. The properties are displayed.
2) Find the ImageSize property.
3) Change it.

Tada! :)
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?




Powered by binpress