Einzelnen Beitrag anzeigen

Green

Registriert seit: 11. Jun 2006
156 Beiträge
 
#40

Re: .Lines in einer geerbten TRichEdit ändern

  Alt 13. Jun 2006, 21:06
Delphi-Quellcode:
unit PRichEdit;

interface

uses
  SysUtils, Classes, Controls, StdCtrls, ComCtrls, Dialogs;

type
  TColoredStrings = class(TStringList)
  private
    { Private-Deklarationen }
  protected
    { Protected-Deklarationen }
  public
    function AddLines(const S:string): integer;
    function Add(const S:string): integer;
    { Public-Deklarationen }
  published
    { Published-Deklarationen }
  end;


  TPRichEdit = class(TRichEdit)
  private
    { Private-Deklarationen }
    FMyLines: TColoredStrings;
  protected
    { Protected-Deklarationen }
  public
    constructor Create( AOWner: TComponent);
    destructor Destroy;
    { Public-Deklarationen }
  published
    { Published-Deklarationen }
    property Lines: TColoredStrings read FMyLines write FMyLines;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Beispiele', [TPRichEdit]);
end;

function TColoredStrings.AddLines(const S:string): integer;
begin
  showmessage(S);
end;

function TColoredStrings.Add(const S:string): integer;
begin
  showmessage(S);
end;


constructor TPRichEdit.Create(AOWner: TComponent);
begin
  inherited Create( AOwner);
  FMyLines := TColoredStrings.Create;
end;

destructor TPRichEdit.Destroy;
begin
  FMyLines.Destroy;
  inherited Destroy;
end;

end.
  Mit Zitat antworten Zitat