GrapeCity SPREAD for WPF 2.0J
ImageCellType クラス
メンバ 

GcSpreadGrid コントロールに画像を表示するセル型を表します。
オブジェクト モデル
ImageCellType クラスIImageSourceConverter インタフェース
構文
'Declaration
 
Public Class ImageCellType 
   Inherits CellTypeBase
public class ImageCellType : CellTypeBase 
次のサンプルはImageCellTypeを作成しイメージ・リンクをイメージに変えるためにImageConverterをセットします。
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
継承階層

System.Object
   GrapeCity.Windows.SpreadGrid.CellTypeBase
      GrapeCity.Windows.SpreadGrid.ImageCellType

参照

ImageCellType メンバ
GrapeCity.Windows.SpreadGrid 名前空間

 

 


Copyright © 2012 GrapeCity inc. All rights reserved.