PowerTools SPREAD for Windows Forms 8.0J
TransparencyTolerance プロパティ (ImageCellType)


画像の透過許容誤差を取得または設定します。
構文
'Declaration
 
Public Property TransparencyTolerance As Integer
'使用法
 
Dim instance As ImageCellType
Dim value As Integer
 
instance.TransparencyTolerance = value
 
value = instance.TransparencyTolerance
public int TransparencyTolerance {get; set;}

プロパティ値

許容誤差を表す Integer
解説
透過許容誤差は、レンダリングされた画像を透過させる場合に、赤、緑、青の各成分がTransparencyColorにどれだけ近い色を透過色とみなすかを決定します。たとえば、TransparencyColorがColor.White(255,255,255)で、TransparencyToleranceが1の場合は、(254,254,254)の色が透過色とみなされます。
次のサンプルコードは、イメージセル型のこのプロパティの設定方法を示します。
FarPoint.Win.Spread.CellType.ImageCellType icelltype =new FarPoint.Win.Spread.CellType.ImageCellType();
icelltype.Style = FarPoint.Win.RenderStyle.Stretch;
icelltype.TransparencyColor = Color.Black;
icelltype.TransparencyTolerance = 100;
fpSpread1.Sheets[0].Rows[0].CellType =icelltype;
System.Drawing.Image image = System.Drawing.Image.FromFile("D:\\alphaomega3.jpg"); 
System.IO.MemoryStream stream = new System.IO.MemoryStream();
byte[] bytes;
string str;
image.Save(stream,System.Drawing.Imaging.ImageFormat.Jpeg);
stream.Seek(0, System.IO.SeekOrigin.Begin); 
bytes = stream.GetBuffer();
str = System.Convert.ToBase64String(bytes);
fpSpread1.Sheets[0].Cells[0,0].Value = image;
fpSpread1.Sheets[0].Cells[0,1].Value = bytes;
fpSpread1.Sheets[0].Cells[0,2].Value = str;
Dim icelltype As New FarPoint.Win.Spread.CellType.ImageCellType
icelltype.Style = FarPoint.Win.RenderStyle.Stretch
icelltype.TransparencyColor = Color.Black
icelltype.TransparencyTolerance = 100
FpSpread1.Sheets(0).Rows(0).CellType = icelltype
Dim image As System.Drawing.Image = System.Drawing.Image.FromFile("D:\alphaomega3.jpg")
Dim stream As New System.IO.MemoryStream
Dim bytes As Byte()
Dim str As String
image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg)
stream.Seek(0, System.IO.SeekOrigin.Begin)
bytes = stream.GetBuffer()
str = System.Convert.ToBase64String(bytes)
FpSpread1.Sheets(0).Cells(0, 0).Value = image
FpSpread1.Sheets(0).Cells(0, 1).Value = bytes
FpSpread1.Sheets(0).Cells(0, 2).Value = str
参照

ImageCellType クラス
ImageCellType メンバ

 

 


© 2004-2015, GrapeCity inc. All rights reserved.