Spread Windows Forms 10.0 Product Documentation
NamedStyleCollectionEventHandler Delegate
ExampleExample 


Represents a defined method that handles the NamedStyleCollection object's Changed event.
Syntax
'Declaration
 
Public Delegate Sub NamedStyleCollectionEventHandler( _
   ByVal sender As Object, _
   ByVal e As NamedStyleCollectionEventArgs _
) 
'Usage
 
Dim instance As New NamedStyleCollectionEventHandler(AddressOf HandlerMethod)
public delegate void NamedStyleCollectionEventHandler( 
   object sender,
   NamedStyleCollectionEventArgs e
)

Parameters

sender
e
Remarks
For information on the event, refer to the NamedStyleCollection Change event.
Example
This example returns the new style added to the collection.
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")};

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 nscChanged(object sender, FarPoint.Win.Spread.NamedStyleCollectionEventArgs e) 
{ 
    MessageBox.Show(e.NewStyle.Name); 
}
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")}

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)

Private Sub nscChanged(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.NamedStyleCollectionEventArgs) Handles nsc.Changed
    MessageBox.Show(e.NewStyle.Name)
End Sub
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

NamedStyleCollectionEventHandler Members
FarPoint.Win.Spread Namespace
NamedStyleCollectionEventArgs Class
Changed Event

 

 


Copyright © GrapeCity, inc. All rights reserved.