写一个Property Editor,这样才能够向TDatabase那样,或者用TDatabase的那个Property Editor .
属性声明没有什么花头。
property Alias: string read FAlias write setAlias;

解决方案 »

  1.   

    找到源码了,贴出来给你。
    type
      TDBStringProperty = class(TStringProperty)
      public
        function GetAttributes: TPropertyAttributes; override;
        procedure GetValueList(List: TStrings); virtual;
        procedure GetValues(Proc: TGetStrProc); override;
      end;type
      TDatabaseNameProperty = class(TDBStringProperty)
      public
        procedure GetValueList(List: TStrings); override;
      end;{ TDBStringProperty }function TDBStringProperty.GetAttributes: TPropertyAttributes;
    begin
      Result := [paValueList, paSortList, paMultiSelect];
    end;procedure TDBStringProperty.GetValueList(List: TStrings);
    begin
    end;procedure TDBStringProperty.GetValues(Proc: TGetStrProc);
    var
      I: Integer;
      Values: TStringList;
    begin
      Values := TStringList.Create;
      try
        GetValueList(Values);
        for I := 0 to Values.Count - 1 do Proc(Values[I]);
      finally
        Values.Free;
      end;
    end;procedure TDatabaseNameProperty.GetValueList(List: TStrings);
    begin
      (GetComponent(0) as TDBDataSet).DBSession.GetDatabaseNames(List);
    end;