Articles in this section
Category / Section

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

1 min read

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

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied