MESCIUS SPREAD for Windows Forms 15.0J
AddIcon メソッド
使用例 

アイコンオブジェクトの名前
アイコンオブジェクト
アイコンオブジェクトをコンテナーに追加します。
構文
'宣言
 
Public Function AddIcon( _
   ByVal name As String, _
   ByVal icon As Icon _
) As Integer
public int AddIcon( 
   string name,
   Icon icon
)

パラメータ

name
アイコンオブジェクトの名前
icon
アイコンオブジェクト

戻り値の型

コンテナー内のオブジェクトのインデックスを指定するint32値。同じ名前を持つアイコンがすでにコンテナーに存在する場合は-1を返します。この場合、新しいアイコンオブジェクトは追加されません。
使用例
次のサンプルコードは、ルールでカスタムアイコンを使用します。
System.Drawing.Icon resource1 = new System.Drawing.Icon("C:\\SpreadWin7\\SpWin7CSharp\\fpicon.ico");
System.Drawing.Icon resource2 = new System.Drawing.Icon("C:\\SpreadWin7\\SpWin7CSharp\\cat.ico");
fpSpread1.CustomIconContainer.AddIcon("fpicon", resource1);
fpSpread1.CustomIconContainer.AddIcon("cat", resource2);
FarPoint.Win.Spread.IconSetConditionalFormattingRule iconRule = new FarPoint.Win.Spread.IconSetConditionalFormattingRule(FarPoint.Win.Spread.ConditionalFormattingIconSetStyle.Custom);
iconRule.IconRuleSet.Add(new FarPoint.Win.Spread.ConditionalFormattingIconValue(0, FarPoint.Win.Spread.ConditionalFormattingValueType.Number, false, new FarPoint.Win.Spread.CustomImageInfo("fpicon")));
iconRule.IconRuleSet.Add(new FarPoint.Win.Spread.ConditionalFormattingIconValue(1, FarPoint.Win.Spread.ConditionalFormattingValueType.Number, false, new FarPoint.Win.Spread.CustomImageInfo("cat")));
fpSpread1_Sheet1.SetValue(0, 0, 0);
fpSpread1_Sheet1.SetValue(1, 0, 1);
fpSpread1_Sheet1.SetValue(2, 0, 2);
fpSpread1_Sheet1.SetConditionalFormatting(0, 0, 3, 1, new FarPoint.Win.Spread.IConditionalFormattingRule[] { iconRule });
Dim resource1 As New System.Drawing.Icon("C:\SpreadWin7\SpWin7CSharp\fpicon.ico")
Dim resource2 As New System.Drawing.Icon("C:\SpreadWin7\SpWin7CSharp\cat.ico")
FpSpread1.CustomIconContainer.AddIcon("fpicon", resource1)
FpSpread1.CustomIconContainer.AddIcon("cat", resource2)
Dim iconRule As New FarPoint.Win.Spread.IconSetConditionalFormattingRule(FarPoint.Win.Spread.ConditionalFormattingIconSetStyle.Custom)
iconRule.IconRuleSet.Add(New FarPoint.Win.Spread.ConditionalFormattingIconValue(0, FarPoint.Win.Spread.ConditionalFormattingValueType.Number, False, New FarPoint.Win.Spread.CustomImageInfo("fpicon")))
iconRule.IconRuleSet.Add(New FarPoint.Win.Spread.ConditionalFormattingIconValue(1, FarPoint.Win.Spread.ConditionalFormattingValueType.Number, False, New FarPoint.Win.Spread.CustomImageInfo("cat")))
FpSpread1_Sheet1.SetValue(0, 0, 0)
FpSpread1_Sheet1.SetValue(1, 0, 1)
FpSpread1_Sheet1.SetValue(2, 0, 2)
FpSpread1_Sheet1.SetConditionalFormatting(0, 0, 3, 1, New FarPoint.Win.Spread.IConditionalFormattingRule() {iconRule})
参照

CustomIconContainer クラス
CustomIconContainer メンバ

 

 


© MESCIUS inc. All rights reserved.