Spread Windows Forms 6.0 Product Documentation
OldStyle Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > NamedStyleCollectionEventArgs Class : OldStyle Property


Glossary Item Box

Gets the old style that was removed or changed, or null if no style was removed or changed.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property OldStyle As NamedStyle
Visual Basic (Usage)Copy Code
Dim instance As NamedStyleCollectionEventArgs
Dim value As NamedStyle
 
value = instance.OldStyle
C# 
public NamedStyle OldStyle {get;}

Property Value

NamedStyle object containing the old style removed or changed, or null if no style was removed or changed

Example

This example returns the old style of the collection.
C#Copy Code
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");
    } 
}
Visual BasicCopy Code
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

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.