public class CubeFunctionInfo : GrapeCity.CalcEngine.Functions.CalcFunction
{
public override string Name { get { return "CUBE"; } }
public override int MinArgs { get { return 1; } }
public override int MaxArgs { get { return 1; } }
public override object Evaluate(object[] args)
{
double num = GrapeCity.CalcEngine.CalcConvert.ToDouble(args[0]);
return num * num * num;
}
public override object Evaluate(object[] args, object context)
{
return Evaluate(args, context);
}
}
gcSpreadSheet1.Sheets[0].AddCustomFunction(new CubeFunctionInfo());
gcSpreadSheet1.Sheets[0].SetFormula(1, 1, "CUBE(4)");
private void Button_Click_1(object sender, RoutedEventArgs e)
{
gcSpreadSheet1.Sheets[0].RemoveCustomFunctions("CUBE");
}
Public Class CubeFunctionInfo
Inherits GrapeCity.CalcEngine.Functions.CalcFunction
Public Overrides ReadOnly Property Name() As String
Get
Return "CUBE"
End Get
End Property
Public Overrides ReadOnly Property MinArgs() As Integer
Get
Return 1
End Get
End Property
Public Overrides ReadOnly Property MaxArgs() As Integer
Get
Return 1
End Get
End Property
Public Overrides Function Evaluate(args As Object()) As Object
Dim num As Double = GrapeCity.CalcEngine.CalcConvert.ToDouble(args(0))
Return num * num * num
End Function
Public Overrides Function Evaluate(args As Object(), context As Object) As Object
Return Evaluate(args, context)
End Function
End Class
GcSpreadSheet1.Sheets(0).AddCustomFunction(New CubeFunctionInfo())
GcSpreadSheet1.Sheets(0).SetFormula(1, 1, "CUBE(4)")
Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
GcSpreadSheet1.Sheets(0).RemoveCustomFunctions("CUBE")
End Sub