type
  TEditEx = class(TEdit)
  private
    { Private declarations }
    FAlignment: TAlignment;
    procedure SetAlignment(const Value: TAlignment);
  protected
    { Protected declarations }
    procedure CreateParams(var Params: TCreateParams); override;
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
  published
    { Published declarations }
    property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
  end;{ TEditEx }constructor TEditEx.Create(AOwner: TComponent);
begin
  inherited;
  FAlignment := taLeftJustify;
end;procedure TEditEx.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  case Alignment of
    taLeftJustify: Params.Style := Params.Style or (ES_LEFT or ES_MULTILINE);
    taRightJustify: Params.Style := Params.Style or (ES_RIGHT or ES_MULTILINE);
    taCenter: Params.Style := Params.Style or (ES_CENTER or ES_MULTILINE);
  end;
end;procedure TEditEx.SetAlignment(const Value: TAlignment);
begin
  if Value <> FAlignment then begin
    FAlignment := Value;
    RecreateWnd;
  end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
  with TEditEx.Create(Self) do begin
    Parent := Self;
    Left := 1;
    Top := 1 * Height + 3;
    Alignment := taLeftJustify;
    Text := 'taLeftJustify';
  end;
  with TEditEx.Create(Self) do begin
    Parent := Self;
    Left := 1;
    Top := 2 * Height + 3;
    Alignment := taRightJustify;
    Text := 'taRightJustify';
  end;
  with TEditEx.Create(Self) do begin
    Parent := Self;
    Left := 1;
    Top := 3 * Height + 3;
    Alignment := taCenter;
    Text := 'taCenter';
  end;
end;