最近下了一个picshow 2.5图像控件有130多种特效.可是确是for delphi 5 的,其前一版本我顺利的改为了delphi 6下安装的.可是这个版本多了些内容.请大家帮帮忙!主要在psreg.pas这个控件注册单元!原码如下:有兴趣的朋友可去海阔天空下载!
unit PSReg;{ TCustomPicShow v2.5
 by Kambiz R. Khojasteh email: [email protected]
 web: http://www.crosswinds.net/~khojasteh/ This component is freeware and may be used in any software
 product (free or commercial) under the condition that I'm
 given proper credit (title, name and e-mail address in the
 documentation or the About box of the product this component
 is used in). Special thanks to:
   [email protected] for help on D5 support.
   Douglass Titjan ([email protected]) for help on D5 support.
   Jerry McLain ([email protected]) for manual control idea.
   M. R. Zamani ([email protected]) for adding 8 effects (110..117).
   Elliott Shevin ([email protected]) for adding 4 effects (123..126).}{$IFDEF VER100}
  {$DEFINE PS_D3}
{$ELSE}
  {$IFDEF VER120}
    {$DEFINE PS_D4}
  {$ELSE}
    {$DEFINE PS_D5OrHigher}
  {$ENDIF}
{$ENDIF}interfaceprocedure Register;implementationuses
  Windows, Classes, Dialogs, SysUtils, DesignIntf,DesignEditors, TypInfo, PicShow;type{ TPicShowComponentEditor }  TPicShowComponentEditor = class(TDefaultEditor)
  protected
    procedure CallPropertyEditor(Proc: TGetPropEditProc);
    procedure PictureEditor(Editor: TPropertyEditor);
    procedure BackgroundEditor(Editor: TPropertyEditor);
  public
    function GetVerbCount: Integer; override;
    function GetVerb(Index: Integer): string; override;
    procedure ExecuteVerb(Index: Integer); override;
    procedure Edit; override;
  end;{ TAboutPropertyEditor }  TAboutPropertyEditor = class(TStringProperty)
  public
    procedure Edit; override;
    function GetValue: string; override;
    function GetAttributes: TPropertyAttributes; override;
  end;{ TPicShowComponentEditor }function TPicShowComponentEditor.GetVerbCount: Integer;
begin
  Result := 5;
end;function TPicShowComponentEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0: Result := 'Picture Editor...';
    1: Result := 'Background Editor...';
    2: Result := '-';
    3: if TPicShow(Component).Busy then
         Result := 'Stop Transition'
       else
         Result := 'Start Transition';
    4: if TPicShow(Component).Busy then
         Result := 'Can''t Clear Screen'
       else
         Result := 'Clear Screen';
  else
    Result := '';
  end;
end;procedure TPicShowComponentEditor.ExecuteVerb(Index: Integer);
begin
  case Index of
    0: CallPropertyEditor(PictureEditor);
    1: CallPropertyEditor(BackgroundEditor);
    2: {Nothing to do};
    3: if TPicShow(Component).Busy then
         TPicShow(Component).Stop
       else
         TPicShow(Component).Execute;
    4: if not TPicShow(Component).Busy then
         TPicShow(Component).Clear;
  else
    inherited ExecuteVerb(Index);
  end;
end;procedure TPicShowComponentEditor.Edit;
begin
  ExecuteVerb(0);
end;procedure TPicShowComponentEditor.CallPropertyEditor    (Proc:TGetPropEditProc);
var
  List: {$IFDEF PS_D5OrHigher} TDesignerSelectionList {$ELSE} TComponentList {$ENDIF};
begin
  {$IFDEF PS_D5OrHigher}
  List := TDesignerSelectionList.Create;
  {$ELSE}
  List := TComponentList.Create;
  {$ENDIF}
  try
    List.Add(Component);
    GetComponentProperties(List, [tkClass], Designer, Proc);
  finally
    List.Free;
  end;
end;procedure TPicShowComponentEditor.PictureEditor(Editor: TPropertyEditor);
begin
  if Editor.GetName = 'Picture' then
    Editor.Edit;
end;procedure TPicShowComponentEditor.BackgroundEditor(Editor: TPropertyEditor);
begin
  if Editor.GetName = 'BgPicture' then
    Editor.Edit;
end;{ TAboutPropertyEditor }function TAboutPropertyEditor.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paReadOnly, paMultiSelect];
end;function TAboutPropertyEditor.GetValue: string;
begin
  Result := '(About)'
end;procedure TAboutPropertyEditor.Edit;
const
  AboutStr = '%s v2.5'#10#13 +
             'by Kambiz R. Khojasteh'#10#13#10#13 +
             'This component is freeware.'#10#13#10#13 +
             'email: [email protected]'#10#13 +
             'web: http://www.crosswinds.net/~khojasteh/';
begin
  MessageDlg(Format(AboutStr, [GetComponent(0).ClassName]), mtInformation, [mbOK], 0);
end;procedure Register;
begin
  RegisterComponents('Samples', [TPicShow, TDBPicShow]);
  RegisterComponentEditor(TPicShow, TPicShowComponentEditor);
  RegisterPropertyEditor(TypeInfo(TAbout), TPicShow, 'About', TAboutPropertyEditor);
  RegisterPropertyEditor(TypeInfo(TAbout), TDBPicShow, 'About', TAboutPropertyEditor);
end;end.
//-------------------------------------------------------------------
其中procedure CallPropertyEditor(Proc: TGetPropEditProc);
的参数在delphi 6中不存在了,好像应该改为:
 procedure CallPropertyEditor(Proc: TGetPropProc);
但是改动后在CallPropertyEditor(PictureEditor);处又出现
[Error] PSReg.pas(99): Incompatible types: 'Parameter lists differ'错误:
请问怎样解决那,TGetPropProc这个参数这样赋值正确吗?
如果正确是否是PictureEditor这个过程的参数出了问题哪?
高手帮忙!

解决方案 »

  1.   

    TGetPropProc的定义如下:
    TGetPropProc = procedure(const Prop: IProperty) of object;
    他和procedure PictureEditor(Editor: TPropertyEditor)定义的参数不同,当然会出错了。如果没有TGetPropEditProc,你就自己定义一个吧。
    Type
      TGetPropEditProc = procedure(const Prop: TPropertyEditor) of object;
      

  2.   

    加上
    type
      TGetPropEditProc = procedure (Editor: TPropertyEditor) of object;—————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    —————————————————————————————————
      

  3.   

    加上
    type
      TGetPropEditProc = procedure (Editor: TPropertyEditor) of object;
    可以通过但是到了
    GetComponentProperties(List, [tkClass], Designer, Proc);这个函数就又会有相同的问题了!