I have some images that i added to imageList Cotrol manually. Now i need remove thart images from imageList depending on the key index and set as panel backgroud.
How should i do it
I have some images that i added to imageList Cotrol manually. Now i need remove thart images from imageList depending on the key index and set as panel backgroud.
How should i do it
Images
that you added in Image list are added to the ImageList.ImageCollection, so it is collection type then you can use most of the collection methods.Use the Images property to add, remove and access the image to display in background of panel. Add(key,image)
Remove()
RemoveAt()
RemoveByKey()
Check the example on the ImageList Class documentation to understand that how pragmatically use all of these methods.
Add Image:
Remove Image from collection:
To access images, get image from the imagecollection
or
Use the
Images
property of theImageList
control.The
ImageList.ImageCollection
object that it returns provides all the methods you need to manipulate the images in the list, includingAdd
andRemove
methods.You can find instructions on setting the background of a
Panel
control here: How to: Set the Background of a Windows Forms Paneli am using imagelist in list view.
let say i have three images in imagelist and want to delete 2 image in it.
i used code
code is deleting 2nd image but after that 3 image is bot visible although it is there