In addition to the built-in function keys in the calculator “+, -, /, *, 1/x, %, sqrt and sq”, the developer can program up to two additional functions into the calculator.
To add custom functions to the control first set the FunctionKeys property to one of the valid enumerations; Dbi.WinControl.Calc.enumFunctionKeys.One or Dbi.WinControl.Calc.enumFunctionKeys.Two. This displays the optional F1 and F2 keys in the control and enables the corresponding key down events on the control (DbicCalc1_Function1 and DbicCalc1_Function2). The developer can then code the appropriate function into the key event.
For example; to implement a function in the F1 key that returns the cube of the value in the calculator display the developer would set the DbicCalc control’s FunctionKeys property to Dbi.WinControl.Calc.enumFunctionKeys.One. In the DbicCalc_Function1 event the developer would then add the following code …
Example:
VB.NET
Private Sub DbicCalcDropDown_Function1(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ DbicCalcDropDown.Function1
‘This code is executed when the user clicks on the F1 function button in the calculator
‘Set the value of the calculator display to the result of the function
Me.DbicCalc1.Value = Me.DbicCalc1.Value * Me.DbiCcalc1.Value * Me.DbicCalc1.Value
End Sub
C#
private void dbicCalc1_Function1(object sender, EventArgs e)
{
//This code is executed when the user clicks on the F1 function button in the calculator
//Set the value of the calculator display to the result of the function
this.dbicCalc1.Value = this.dbicCalc1.Value * this.dbicCalc1.Value * this.dbicCalc1.Value;
}