Articles in this section

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

Show GIF images in cell


In order to insert an image in a cell as a PictureBox control, you can set the CellType property as Control and a PictureBox control can be added to the cell by using the 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
AddHandler 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
 The screenshot below illustrates the Images in a Grid Column

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)
Access denied
Access denied