Spread ASP.NET 15
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / NamedStyle Class / Changed Event

In This Topic
    Changed Event (NamedStyle)
    In This Topic
    Occurs when the named style has changed.
    Public Event Changed As EventHandler
    Dim instance As NamedStyle
    Dim handler As EventHandler
    AddHandler instance.Changed, handler
    public event EventHandler Changed
    The event handler receives an argument of type EventHandler containing data related to this event.
    This example changes the background color for the named style.
    protected FarPoint.Web.Spread.NamedStyle ns;
    protected FarPoint.Web.Spread.NamedStyleCollection nsc;
    nsc = new FarPoint.Web.Spread.NamedStyleCollection();
    ns = new FarPoint.Web.Spread.NamedStyle("StyleData", "DataAreaDefault");
    ns.BackColor = Color.LightBlue;
    ns.Border = new FarPoint.Web.Spread.Border(Color.Red);
    ns.Parent = "DataAreaDefault";
    FpSpread1.ActiveSheetView.SetText(0, 0, "NamedStyle");
    FpSpread1.ActiveSheetView.Columns[0].Width = 120;
    FpSpread1.ActiveSheetView.Rows[0].Height = 80;
    FpSpread1.ActiveSheetView.DefaultStyle = nsc[0];
    ns.Changed += new EventHandler(nsChanged);
    private void Button1Click(object sender, System.EventArgs e)
         ns.BackColor = Color.Yellow;
    private void nsChanged(object sender, EventArgs e)
         Response.Write("The new back color is " + ns.BackColor.ToString());
    Friend WithEvents ns As FarPoint.Web.Spread.NamedStyle
    Friend WithEvents nsc As FarPoint.Web.Spread.NamedStyleCollection
    nsc = New FarPoint.Web.Spread.NamedStyleCollection
    ns = New FarPoint.Web.Spread.NamedStyle("StyleData", "DataAreaDefault")
    ns.BackColor = Color.LightBlue
    ns.Border = New FarPoint.Web.Spread.Border(Color.Red)
    ns.Parent = "DataAreaDefault"
    FpSpread1.ActiveSheetView.SetText(0, 0, "NamedStyle")
    FpSpread1.ActiveSheetView.Columns(0).Width = 120
    FpSpread1.ActiveSheetView.Rows(0).Height = 80
    FpSpread1.ActiveSheetView.DefaultStyle = nsc(0)
    Dim eh As System.EventHandler = AddressOf nsChanged
    AddHandler ns.Changed, eh
    Private Sub Button1Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
         ns.BackColor = Color.Yellow
    End Sub
    Private Sub nsChanged(ByVal sender As Object, ByVal e As System.EventArgs)
         Response.Write("The new back color is " & ns.BackColor.ToString())
    End Sub
    See Also