PowerTools SPREAD for Windows Forms 10.0J
Style プロパティ (ConditionalFormat)


条件書式のスタイルを取得または設定します。
構文
'Declaration
 
Public Property Style As NamedStyle
'使用法
 
Dim instance As ConditionalFormat
Dim value As NamedStyle
 
instance.Style = value
 
value = instance.Style
public NamedStyle Style {get; set;}

プロパティ値

スタイルを含むNamedStyleオブジェクト

次のサンプルコードは、書式のスタイルの背景色を返します。

FarPoint.Win.Spread.NamedStyle styleCold = new FarPoint.Win.Spread.NamedStyle();  
FarPoint.Win.Spread.NamedStyle styleCool = new FarPoint.Win.Spread.NamedStyle();  
FarPoint.Win.Spread.NamedStyle styleMild = new FarPoint.Win.Spread.NamedStyle();  
FarPoint.Win.Spread.NamedStyle styleWarm = new FarPoint.Win.Spread.NamedStyle();  
FarPoint.Win.Spread.NamedStyle styleHot = new FarPoint.Win.Spread.NamedStyle();  
styleCold.BackColor = Color.Blue;  
styleCold.ForeColor = Color.White;  
styleCool.BackColor = Color.Cyan;  
styleMild.BackColor = Color.Lime;  
styleWarm.BackColor = Color.Yellow;  
styleHot.BackColor = Color.Red;  
fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCold, FarPoint.Win.Spread.ComparisonOperator.LessThan, "32");  
fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCool, FarPoint.Win.Spread.ComparisonOperator.Between, "32", "55"); 
fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleMild, FarPoint.Win.Spread.ComparisonOperator.Between, "55", "75"); 
fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleWarm, FarPoint.Win.Spread.ComparisonOperator.Between, "75", "85"); 
fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleHot, FarPoint.Win.Spread.ComparisonOperator.GreaterThan, "85");  
 fpSpread1.ActiveSheet.Cells[1, 1].Value = 38; 
 
FarPoint.Win.Spread.ConditionalFormat[]cf;   
cf = fpSpread1.ActiveSheet.GetConditionalFormats(1, 1, false);  
foreach (FarPoint.Win.Spread.ConditionalFormat item in cf)  
{  
      MessageBox.Show(item.Style.BackColor.ToString());  
}
Dim styleCold As New FarPoint.Win.Spread.NamedStyle
Dim styleCool As New FarPoint.Win.Spread.NamedStyle
Dim styleMild As New FarPoint.Win.Spread.NamedStyle
Dim styleWarm As New FarPoint.Win.Spread.NamedStyle
Dim styleHot As New FarPoint.Win.Spread.NamedStyle 
styleCold.BackColor = Color.Blue 
styleCold.ForeColor = Color.White 
styleCool.BackColor = Color.Cyan 
styleMild.BackColor = Color.Lime 
styleWarm.BackColor = Color.Yellow 
styleHot.BackColor = Color.Red

Dim co As New FarPoint.Win.Spread.ComparisonOperator
FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCold, co.LessThan,"32")
FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCool, co.Between, "32", "55") 
FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleMild, co.Between, "55", "75") 
FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleWarm, co.Between, "75", "85") 
FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleHot, co.GreaterThan,"85")

FpSpread1.ActiveSheet.Cells(1, 1).Value = 38

Dim cf As FarPoint.Win.Spread.ConditionalFormat()
Dim item As New FarPoint.Win.Spread.ConditionalFormat(styleCool)
cf = FpSpread1.ActiveSheet.GetConditionalFormats(1, 1, False) 
For Each item In cf
      MessageBox.Show(item.Style.BackColor.ToString())
Next
参照

ConditionalFormat クラス
ConditionalFormat メンバ

 

 


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