Dim nsc As New FarPoint.Win.Spread.NamedStyleCollection()
Dim ns1 As New FarPoint.Win.Spread.NamedStyle("StyleHeaders", "HeaderDefault")
Dim ns2 As New FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault")
Dim ns3 As New FarPoint.Win.Spread.NamedStyle("btncellstyle")
Dim i As Integer
ns1.BackColor = Color.LightBlue
ns2.BackColor = Color.Gray
ns3.CellType = New FarPoint.Win.Spread.CellType.ButtonCellType()
nsc.AddRange(New Object() {ns1, ns2})
nsc.Insert(1, ns3)
FpSpread1.NamedStyles = nsc
FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = nsc(0)
FpSpread1.ActiveSheet.DefaultStyle = nsc(2)
FpSpread1.ActiveSheet.Cells(0, 0).StyleName = "btncellstyle"
i = nsc.IndexOf(ns3)
Label1.Text = "The index of btncellstyle in the collection is " & i.ToString()