)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show GIF images in cell with PictureBox control in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: May 10, 2016 |
Last Revised Date: February 12, 2020
Tags: celltype, image

Show GIF images in cell

In order to insert an image in a cell as PictureBox control, you can set the CellType property as Control and PictureBox control can be added to the cell by using Control property.

C#

this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;
 
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
   if (e.TableCellIdentity.ColIndex == 2 && e.TableCellIdentity.RowIndex != 1)
   {
      if (e.Style.Text == "Image0")
      {
         e.Style.CellType = GridCellTypeName.Control;
         e.Style.Control = p1;
      }
      if (e.Style.Text == "Image1")
      {
         e.Style.CellType = GridCellTypeName.Control;
         e.Style.Control = p2;
      }
      if (e.Style.Text == "Image2")
      {
         e.Style.CellType = GridCellTypeName.Control;
         e.Style.Control = p3;
      }
      if (e.Style.Text == "Image3")
      {
         e.Style.CellType = GridCellTypeName.Control;
         e.Style.Control = p4;
      }
   }
}
 

VB

Private Me.gridGroupingControl1.QueryCellStyleInfo += AddressOf gridGroupingControl1_QueryCellStyleInfo
 
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs)
   If e.TableCellIdentity.ColIndex = 2 AndAlso e.TableCellIdentity.RowIndex <> 1 Then
      If e.Style.Text = "Image0" Then
         e.Style.CellType = GridCellTypeName.Control
         e.Style.Control = p1
      End If
      If e.Style.Text = "Image1" Then
         e.Style.CellType = GridCellTypeName.Control
         e.Style.Control = p2
      End If
      If e.Style.Text = "Image2" Then
         e.Style.CellType = GridCellTypeName.Control
         e.Style.Control = p3
      End If
      If e.Style.Text = "Image3" Then
         e.Style.CellType = GridCellTypeName.Control
         e.Style.Control = p4
      End If
   End If
End Sub

 

Show gif image in cell

Samples:

C#: PictureBox in a Column_CS

VB: PictureBox in a Column_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon