Spread Windows Forms 11.0 Product Documentation
ShapeActivated Event
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : ShapeActivated Event
Occurs when the user changes the active shape object.
Syntax
'Declaration
 
Public Event ShapeActivated As EventHandler
'Usage
 
Dim instance As FpSpread
Dim handler As EventHandler
 
AddHandler instance.ShapeActivated, handler
public event EventHandler ShapeActivated
Remarks
This event is raised by the OnShapeActivated method when the user changes the active shape object.
Example
This example puts text in a textbox when the shape is activated.
private void Form1_Load(object sender, System.EventArgs e)
{
     FarPoint.Win.Spread.DrawingSpace.RectangleShape rShape = new FarPoint.Win.Spread.DrawingSpace.RectangleShape();
     // Assign a name, overriding the unique default assigned name. 
     rShape.Name = "myRect1";
     // Assign a location at which to start the display of the shape. 
     rShape.Top = 20;
     rShape.Left = 60;
     // Assign a custom fill color to the shape. 
     rShape.BackColor = Color.Blue;
     // Assign a size to the shape.
     rShape.Width = 100;
     rShape.Height = 100;
     // Add the shape to the sheet so that it appears on that sheet. 
     fpSpread1.ActiveSheet.AddShape(rShape); 
}

private void fpSpread1_ShapeActivated(object sender, System.EventArgs e)
{
     textBox1.Text = "Shape Activated";
}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Dim rShape As New FarPoint.Win.Spread.DrawingSpace.RectangleShape
     ' Assign a name, overriding the unique default assigned name. 
     rShape.Name = "myRect1" 
     ' Assign a location at which to start the display of the shape. 
     rShape.Top = 20
     rShape.Left = 60
     ' Assign a custom fill color to the shape. 
     rShape.BackColor = Color.Blue
     ' Assign a size to the shape.
     rShape.Width = 100
     rShape.Height = 100
     ' Add the shape to the sheet so that it appears on that sheet. 
     FpSpread1.ActiveSheet.AddShape(rShape)
End Sub

Private Sub FpSpread1_ShapeActivated(ByVal sender As Object, ByVal e As System.EventArgs) Handles FpSpread1.ShapeActivated
     TextBox1.Text = "Shape Activated"
End Sub
See Also

Reference

FpSpread Class
FpSpread Members