PowerTools SPREAD for Windows Forms 10.0J
Count プロパティ (NamedStyleCollection)


コレクション内のスタイル(NamedStyleオブジェクト)の数を取得します。
構文
'Declaration
 
Public Overridable ReadOnly Property Count As Integer
'使用法
 
Dim instance As NamedStyleCollection
Dim value As Integer
 
value = instance.Count
public virtual int Count {get;}

プロパティ値

コレクション内のスタイルの数を表すInteger
次のサンプルコードでは、このメンバを使用して、コレクション内のスタイルの数を返しています。
FarPoint.Win.Spread.NamedStyleCollection nsc = new FarPoint.Win.Spread.NamedStyleCollection();
FarPoint.Win.Spread.NamedStyle ns1 = new FarPoint.Win.Spread.NamedStyle("StyleHeaders", "HeaderDefault");
FarPoint.Win.Spread.NamedStyle ns2 = new FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault");
DialogResult dlg;
ns1.BackColor = Color.LightBlue;
ns2.BackColor = Color.Gray;
nsc.AddRange(new Object[] {ns1, ns2});
fpSpread1.NamedStyles = nsc;
fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = nsc[0];
fpSpread1.ActiveSheet.DefaultStyle = nsc[1];
label1.Text = "There are " + nsc.Count.ToString() + " named styles in the collection.";
dlg = MessageBox.Show("Do you want to remove StyleHeaders from the collection?", "Remove", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
nsc.RemoveAt(0);
label1.Text = "There are " + nsc.Count.ToString() + " named styles in the collection.";
}
Dim nsc As New FarPoint.Win.Spread.NamedStyleCollection()
Dim ns1 As New FarPoint.Win.Spread.NamedStyle("StyleHeaders", "HeaderDefault")
Dim ns2 As New FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault")
Dim dlg As DialogResult
ns1.BackColor = Color.LightBlue
ns2.BackColor = Color.Gray
nsc.AddRange(New Object() {ns1, ns2})
FpSpread1.NamedStyles = nsc
FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = nsc(0)
FpSpread1.ActiveSheet.DefaultStyle = nsc(1)
Label1.Text = "There are " & nsc.Count.ToString() & " named styles in the collection."
dlg = MessageBox.Show("Do you want to remove StyleHeaders from the collection?", "Remove", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
nsc.RemoveAt(0)
Label1.Text = "There are " & nsc.Count.ToString() & " named styles in the collection."
End If
参照

NamedStyleCollection クラス
NamedStyleCollection メンバ

 

 


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