PowerTools SPREAD for ASP.NET 8.0J
Changed イベント (NamedStyle)

名前付きスタイルが変更されたときに発生します。
構文
'Declaration
 
Public Event Changed As EventHandler
public event EventHandler Changed
解説
このイベントハンドラは、このイベントに関連するデータを含むEventHandlerタイプの引数を受け取ります。
この例では、名前付きスタイルの背景色を変更します。
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
参照

NamedStyle クラス
NamedStyle メンバ
Changed イベント

 

 


© 2003-2015, GrapeCity inc. All rights reserved.