Spread Windows Forms 7.0 Product Documentation
PerformAction Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > Action Class : PerformAction Method


sender
Object on which the action occurred

Glossary Item Box

Invoked when an action occurs.

Syntax

Visual Basic (Declaration) 
Public MustOverride Sub PerformAction( _
   ByVal sender As Object _
) 
Visual Basic (Usage)Copy Code
Dim instance As Action
Dim sender As Object
 
instance.PerformAction(sender)
C# 
public abstract void PerformAction( 
   object sender
)

Parameters

sender
Object on which the action occurred

Example

This example changes the background color of the cell to red if the user types a minus sign as the first character in the cell.
C#Copy Code
public class ColorAction : FarPoint.Win.Spread.Action
{
       public override void PerformAction(object sender)
       {
              if (sender is FarPoint.Win.Spread.SpreadView)
              {
                     FarPoint.Win.Spread.SpreadView spread = (FarPoint.Win.Spread.SpreadView)sender;
                     FarPoint.Win.Spread.SheetView sheet = spread.Sheets[spread.ActiveSheetIndex];
                     sheet.Cells[sheet.ActiveRowIndex, sheet.ActiveColumnIndex].BackColor = Color.Red;
              }
       }
}

FarPoint.Win.Spread.InputMap im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
FarPoint.Win.Spread.ActionMap am = fpSpread1.GetActionMap();
im.Put(new FarPoint.Win.Spread.Keystroke(Keys.OemMinus, Keys.None), "ColorAction");
am.Put("ColorAction", new ColorAction());
Visual BasicCopy Code
Public Class ColorAction
Inherits FarPoint.Win.Spread.Action

Public Overrides Sub PerformAction(ByVal sender As Object)
If TypeOf sender Is FarPoint.Win.Spread.SpreadView Then
Dim spread As FarPoint.Win.Spread.SpreadView = CType(sender, FarPoint.Win.Spread.SpreadView)
Dim sheet As FarPoint.Win.Spread.SheetView = spread.Sheets(spread.ActiveSheetIndex)
sheet.Cells(sheet.ActiveRowIndex, sheet.ActiveColumnIndex).BackColor = Color.Red
End If
End Sub
End Class

Dim im As FarPoint.Win.Spread.InputMap = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
Dim am As FarPoint.Win.Spread.ActionMap = FpSpread1.GetActionMap()
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.OemMinus, Keys.None), "ColorAction")
am.Put("ColorAction", New ColorAction)

Requirements

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

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.