ImageSlides in Windows Forms Carousel

18 Nov 20182 minutes to read

ImageSlides is a dedicated property for adding and displaying images in the Carousel control, and it also provides several customization options. The default value of this property is false.

this.carousel1.ImageSlides = true;
Me.carousel1.ImageSlides = True

You can add images to the Carousel control only when the ImageSlides property is true. You can populate images in the following three ways:

Through ImageListCollection

Add CarouselImage instances to the ImageListCollection.

CarouselImage carouselImage1 = new CarouselImage();
carouselImage1.ItemImage = System.Drawing.Image.FromFile(@"C:\Images\image1.png");
this.carousel1.ImageListCollection.Add(carouselImage1);
Dim carouselImage1 As New CarouselImage()
carouselImage1.ItemImage = System.Drawing.Image.FromFile("C:\Images\image1.png")
Me.carousel1.ImageListCollection.Add(carouselImage1)

Through image list

Assign an ImageList containing images directly to the control. The control will be populated with the images stored in the image list.

System.Windows.Forms.ImageList imageList1 = new System.Windows.Forms.ImageList();
imageList1.Images.Add(System.Drawing.Image.FromFile(@"C:\Images\image1.png"));
imageList1.Images.Add(System.Drawing.Image.FromFile(@"C:\Images\image2.png"));
this.carousel1.ImageList = imageList1;
Dim imageList1 As New System.Windows.Forms.ImageList()
imageList1.Images.Add(System.Drawing.Image.FromFile("C:\Images\image1.png"))
imageList1.Images.Add(System.Drawing.Image.FromFile("C:\Images\image2.png"))
Me.carousel1.ImageList = imageList1

Through file path

Assign the path of a folder to the FilePath property. Images from the specified location will be fetched and arranged in the control.

this.carousel1.FilePath = @"C:\Images";
Me.carousel1.FilePath = "C:\Images"