Class GridImageColumn
Represents a column that used to display the image as the edit element.
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Syncfusion.WinForms.DataGrid
Assembly: Syncfusion.SfDataGrid.WinForms.dll
Syntax
public class GridImageColumn : GridColumn, IDisposable, IFilterDefinition
Examples
// GridImageColumn can be created and images can be added to it as given below.
GridImageColumn column = new GridImageColumn();
column.MappingName = "Images";
sfDataGrid1.Columns.Add(column);
// The image will be added to the column be adding the image to the underlying data as below.
public class OrderInfo : INotifyPropertyChanged
{
public byte[] Images { get; set; }
}
public class OrderInfoCollection : IDisposable
{
public OrderInfoCollection()
{
OrdersListDetails = new OrderInfoRepository().GetListOrdersDetails(200);
}
public BindingList<OrderInfo> GetListOrdersDetails(int count)
{
BindingList<OrderInfo> ordersDetails = new BindingList<OrderInfo>();
for (int i = 10000; i < count + 10000; i++)
{
ordersDetails.Add(GetOrder(i));
}
return ordersDetails;
}
private OrderInfo GetOrder(int i)
{
if (order.OrderID % 2 == 0)
order.Images = ImageToByteArray(Image.FromFile(@"..\..\Images\US.jpg"));
else if (order.OrderID % 3 == 0)
order.Images = ImageToByteArray(Image.FromFile(@"..\..\Images\Japan.jpg"));
else
order.Images = ImageToByteArray(Image.FromFile(@"..\..\Images\UK.jpg"));
return order;
}
public byte[] ImageToByteArray(System.Drawing.Image imageIn)
{
MemoryStream ms = new MemoryStream();
imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
return ms.ToArray();
}
}
Constructors
GridImageColumn()
Initializes a new instance of the GridImageColumn class.
Declaration
public GridImageColumn()
Properties
ImageLayout
Gets or sets the position of the image on the control.
Declaration
[Cloneable(true)]
public ImageLayout ImageLayout { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ImageLayout |
TextImageRelation
Gets or sets the position of the text and image relative to each other.
Declaration
[Cloneable(true)]
public TextImageRelation TextImageRelation { get; set; }
Property Value
Type |
---|
System.Windows.Forms.TextImageRelation |
Implements
System.IDisposable