public void CreateImageCell1()
{
ImageCellType imageCellType1 = new ImageCellType();
imageCellType1.Stretch = System.Windows.Media.Stretch.UniformToFill;
//If the Cell.Value is 'http://www.gcpowertools.com.cn/products/img/mr/ImageCell.jpg',
//which is an address linked to a image, you can use the following MyImageConverter to represent that image.
imageCellType1.ImageConverter = new MyImageConverter();
this._gcSpreadGrid1[0, 0].CellType = imageCellType1;
}
class MyImageConverter : IImageSourceConverter
{
public System.Windows.Media.ImageSource GetImageSource(object value)
{
if (value != null)
{
var image = new System.Windows.Media.Imaging.BitmapImage(new Uri(value.ToString(), UriKind.Absolute));
return image;
}
return null;
}
}
Public Sub CreateImageCell1()
Dim imageCellType1 As New ImageCellType()
imageCellType1.Stretch = System.Windows.Media.Stretch.UniformToFill
'If the Cell.Value is 'http://www.gcpowertools.com.cn/products/img/mr/ImageCell.jpg',
'which is an address linked to a image, you can use the following MyImageConverter to represent that image.
imageCellType1.ImageConverter = New MyImageConverter()
Me._gcSpreadGrid1(0, 0).CellType = imageCellType1
End Sub
Private Class MyImageConverter
Implements IImageSourceConverter
Public Function GetImageSource(value As Object) As System.Windows.Media.ImageSource Implements IImageSourceConverter.GetImageSource
If value IsNot Nothing Then
Dim image = New System.Windows.Media.Imaging.BitmapImage(New Uri(value.ToString(), UriKind.Absolute))
Return image
End If
Return Nothing
End Function
End Class