unit Alignment;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, ToolWin, ImgList;

type
  TForm1 = class(TForm)
    ToolBar1: TToolBar;
    RichEdit1: TRichEdit;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    ToolbarImages: TImageList;
    procedure ToolButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: TAlignment
// Property: ComCtrls.TParaAttributes.Alignment

// BeginCode
{
To use this example, place a Toolbar and a RichEdit on the 
form. Right click the toolbar and select New Button three 
times.  Place the ToolButton1Click handling code in the on 
click event of the first TToolButton, then attach the same 
OnClick handler for each button.  Double click on the Image-
List to load the images.  Load in the order right, center
and left.  Name the Imagelist ToolbarImages.  Select the
Toolbar and set the Images property to ToolbarImages.  Then
select each ToolButton and set the ImageIndex property. 
}
procedure TForm1.ToolButton1Click(Sender: TObject);
begin
   if (Sender = ToolButton1) then
    RichEdit1.Paragraph.Alignment := taLeftJustify
  else if (Sender = Toolbutton2) then
    RichEdit1.Paragraph.Alignment := taCenter
  else if (Sender = Toolbutton3) then
    RichEdit1.Paragraph.Alignment := taRightJustify;

end;
// EndCode
// EndExample: TAlignment
end.

