MESCIUS SPREAD for Windows Forms 17.0J
OldStyle プロパティ

削除または変更された古いスタイルを取得します。 削除または変更されたスタイルがない場合は、Nullを返します。
構文
'Declaration
 
Public ReadOnly Property OldStyle As NamedStyle
public NamedStyle OldStyle {get;}

プロパティ値

削除または変更された古いスタイルを含むNamedStyleオブジェクト。削除または変更された古いスタイルがない場合はNull。
次のサンプルコードは、コレクションの古いスタイルを返します。
FarPoint.Win.Spread.NamedStyleCollection nsc;

FarPoint.Win.Spread.NamedStyle[] ns = {new FarPoint.Win.Spread.NamedStyle("Style1"),
new FarPoint.Win.Spread.NamedStyle("Style2"),
new FarPoint.Win.Spread.NamedStyle("Style3")};

private void Form1Load(object sender, System.EventArgs e)
{
    nsc = new FarPoint.Win.Spread.NamedStyleCollection();

    this.nsc.Changed += new FarPoint.Win.Spread.NamedStyleCollectionEventHandler(this.nscChanged); 

    ns[0].Font = new Font("Comic Sans Serif", 12);
    ns[0].Name = "StyleHeaders";
    ns[0].Parent = "HeaderDefault";

    nsc.AddRange(ns);

    fpSpread1.NamedStyles = nsc;
    fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = ns[0];
}

private void button1Click(object sender, System.EventArgs e)
{
    ns[1].Font = new Font("MS Sans Serif", 12);
    ns[1].Name = "StyleHeaders2";

    nsc.Add(ns[1]);

    fpSpread1.NamedStyles = nsc;
    fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = ns[1];

}

private void nscChanged(object sender, FarPoint.Win.Spread.NamedStyleCollectionEventArgs e) 
{ 
    try
    {
        MessageBox.Show(e.OldStyle.Name);
    }
    catch (Exception ex)
    {
        MessageBox.Show("No Old Style to Report");
    } 
}
Friend WithEvents nsc As FarPoint.Win.Spread.NamedStyleCollection

Dim ns As FarPoint.Win.Spread.NamedStyle() = {New FarPoint.Win.Spread.NamedStyle("Style1"), 
New FarPoint.Win.Spread.NamedStyle("Style2"), 
New FarPoint.Win.Spread.NamedStyle("Style3")}

Private Sub Form1Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    nsc = New FarPoint.Win.Spread.NamedStyleCollection

    Dim eh As FarPoint.Win.Spread.NamedStyleCollectionEventHandler = AddressOf nscChanged
    AddHandler nsc.Changed, eh

    ns(0).Font = New Font("Comic Sans Serif", 12)
    ns(0).Name = "StyleHeaders"
    ns(0).Parent = "HeaderDefault"

    nsc.AddRange(ns)

    FpSpread1.NamedStyles = nsc
    FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = ns(0)

End Sub

Private Sub nscChanged(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.NamedStyleCollectionEventArgs) Handles nsc.Changed
    Try
        MessageBox.Show(e.OldStyle.Name)
    Catch ex As Exception
        MessageBox.Show("No Old Style to Report")
    End Try
End Sub

Private Sub Button1Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    ns(1).Font = New Font("MS Sans Serif", FontStyle.Bold)
    ns(1).Name = "StyleHeaders2"

    nsc.Add(ns(1))

    FpSpread1.NamedStyles = nsc
    FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = ns(1)

End Sub
参照

NamedStyleCollectionEventArgs クラス
NamedStyleCollectionEventArgs メンバ

 

 


© MESCIUS inc. All rights reserved.