areacustomfunc.pas

来自「DevExpress公司出品的Borland Delphi和C++ Builde」· PAS 代码 · 共 37 行

PAS
37
字号
unit AreaCustomFunc;

interface

procedure RegisterCustomFunction;

implementation

uses cxExcelConst, cxSSFormulas;

procedure AreaFunc(Sender: TcxSSFunctionHandler);
  procedure AreaFuncCallBack(Sender: TcxSSFunctionHandler; const Value: Double);
  begin
    if Sender.CallBackIndex = 0 then
      Sender.FloatValue := Value
    else
      Sender.FloatValue := Sender.FloatValue * Value;
  end;
begin
  Sender.EnumParamValues(@AreaFuncCallBack, [vtFloat]);
  Sender.SetFloatResult(Sender.FloatValue);
end;

procedure RegisterCustomFunction;
const
  cxFuncDefinition: TcxFuncDefinition =
    (Token: $FFFF-1; Name: 'Area'; Definition: AreaFunc; Params: fpFixed; ParamsCount: 2);
begin
  TcxSSFunctionHandler.RegisterFunctions([cxFuncDefinition]);
end;

initialization

  RegisterCustomFunction;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?