Spread for ASP.NET 8.0 Product Documentation
Changed Event (NamedStyle)
Example 


Occurs when the named style has changed.
Syntax
'Declaration
 
Public Event Changed As EventHandler
'Usage
 
Dim instance As NamedStyle
Dim handler As EventHandler
 
AddHandler instance.Changed, handler
public event EventHandler Changed
Remarks
The event handler receives an argument of type EventHandler containing data related to this event.
Example
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";
nsc.Add(ns);
FpSpread1.NamedStyles.Add(nsc[0]);
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"
nsc.Add(ns)
FpSpread1.NamedStyles.Add(nsc(0))
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
Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

NamedStyle Class
NamedStyle Members
Changed Event

 

 


Copyright © GrapeCity, inc. All rights reserved.