Image Settings of GroupView in Windows Forms GroupView

28 Apr 20213 minutes to read

This section describes the image options available for GroupView.

To add images to the GroupView, ImageList control must be added to the form with images. ImageList control containing large or small images can be set using the properties given below.

NOTE

If the application requirements deem that the GroupView will always display the same-sized image, then it is sufficient to assign just one ImageList. For the VS.NET toolbox interface, the GroupView will use only a single 16*16-sized small image list.

this.groupView1.LargeImageList = this.imageList2;

this.groupView1.SmallImageView = true;

this.groupView1.SmallImageList = this.imageList1;
Me.groupView1.LargeImageList = Me.imageList2

Me.groupView1.SmallImageView = True

Me.groupView1.SmallImageList = Me.imageList1

NOTE

Setting Image list component to the above properties will not actually associate the images with the GroupView Item. We need to set the ImageIndex of the images to the GroupView Item through the GroupViewItems Collection editor.

Image settings of GroupView

Image settings of GroupView

Highlighting images

We can highlight the image of the GroupView Item when the mouse is moved over it by setting the HighlightImage property to true.

this.groupView1.HighLightImage = true;
Me.groupView1.HighLightImage = True

Highlighting images

Image offset settings

The following properties are used to set the image offset for the GroupView Items.

NOTE

HighlightImage property must be set to true in all the cases.

this.groupView1.SelectedImageOffset = new System.Drawing.Point(8, 8);

this.groupView1.SelectingImageOffset = new System.Drawing.Point(6, 6);

this.groupView1.HighlightImageOffset = new System.Drawing.Point(5, 5);

this.groupView1.SelectedHighlightImageOffset = new System.Drawing.Point(5, 5);
Me.groupView1.SelectedImageOffset = New System.Drawing.Point(8, 8)

Me.groupView1.SelectingImageOffset = New System.Drawing.Point(6, 6)

Me.groupView1.HighlightImageOffset = New System.Drawing.Point(5, 5)

Me.groupView1.SelectedHighlightImageOffset = New System.Drawing.Point(5, 5)

The following table lists the methods related to the above properties.

Image spacing

We can provide spacing between the highlighted edge of a GroupView Item and the image by setting the ImageSpacing property to integer values.

HighlightImage property must be set to true.

this.groupView1.ImageSpacing = 7;
Me.groupView1.ImageSpacing = 7

Image spacing