ShowAverageDlg example for Delphi

procedure TForm1.ShowAverageDlg1Click(Sender: TObject); 
var
   nRet: L_INT; 
begin
   LEADDlgImgEffect1.DlgFlags:= DLG_AVERAGE_SHOW_PREVIEW Or
                           DLG_AVERAGE_SHOW_TOOL_ZOOMLEVEL; 

   LEADDlgImgEffect1.LEADImage:= LEADImage1; 
   nRet:= LEADDlgImgEffect1.ShowAverageDlg ( Self ); 
   if ( nRet = SUCCESS_DLG_OK ) then
   begin
      LEADImage1.Average ( LEADDlgImgEffect1.Dimension ); 
   end; 
end;