FIsWWDBGrid: Boolean;
     FIsTMSDBGrid: Boolean;procedure TSMExportBaseComponent.SetDBGrid(AValue: TCustomControl{TCustomGrid});
begin
  if (AValue = nil) or PropIsDBGrid(AValue, FIsWWDBGrid, FIsTMSDBGrid) then
  begin
    FDBGrid := AValue;
    if AValue <> nil then
      AValue.FreeNotification(Self);
  end
  else
    raise Exception.Create(Format(GetLanguageString(1), [AValue.Name]));
end;
  
详细解释每一句的作用? PropIsDBGrid ,FreeNotification, 什么功能?

解决方案 »

  1.   

    PropIsDBGrid应该是自定义函数。
      

  2.   

    FreeNotification(Self) 的作用是通知delphi设计器(Designer)在AValue释放时,通知你的类(TSMExportBaseComponent)。 这样,让在Form(DataModule)设计时,删除链接的组件时,这里是
    一个TCustomControl,类TSMExportBaseComponent的内部可以正确处理相关的调用值。
      

  3.   

    谢谢楼上的两位,这是什么功能
         raise Exception.Create(Format(GetLanguageString(1), [AValue.Name]));
     整个连贯起来应该怎么是什么功能,希望那位大虾指点
      

  4.   

    AValue.FreeNotification(Self);是容器类控件通知自己上面控件销毁的方法.
    PropIsDBGrid或许是一个自定义的方法
    raise Exception.Create(Format(GetLanguageString(1), [AValue.Name]));是创建并抛出一个异常.这个异常类接收一上STRING类型的参数.
      

  5.   

    raise Exception.Create(Format(GetLanguageString(1), [AValue.Name]));
    ////////////
    抛出一个异常...这里将会显示AValue.Name这个值。。比如:
    var
      tmp: integer;
    begin
      tmp := 0;
      if tmp = 0 then
        raise Exception.Create('tmp 为0')
      else
        ShowMessage(inttoStr(5/tmp)); 
    end;