RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Controls.TAlign Enumeration

TAlign specifies the alignment of a control within its parent.

Pascal
TAlign = (
  alNone,
  alTop,
  alBottom,
  alLeft,
  alRight,
  alClient,
  alCustom
);
C++
enum TAlign {
  alNone,
  alTop,
  alBottom,
  alLeft,
  alRight,
  alClient,
  alCustom
};

TAlign specifies how a control is placed relative to its parent. It can have one of the following values:

Value 
Meaning 
alNone  
The control remains where it was placed. This is the default value.  
alTop  
The control moves to the top of its parent and resizes to fill the width of its parent. The height of the control is not affected.  
alBottom  
The control moves to the bottom of its parent and resizes to fill the width of its parent. The height of the control is not affected.  
alLeft  
The control moves to the left side of its parent and resizes to fill the height of its parent. The width of the control is not affected.  
alRight  
The control moves to the right side of its parent and resizes to fill the height of its parent. The width of the control is not affected.  
alClient  
The control resizes to fill the client area of its parent. If another control already occupies part of the client area, the control resizes to fit within the remaining client area.  
alCustom  
The control's positioning is determined by calls to its parent's CustomAlignInsertBefore and CustomAlignPosition methods.  

 

C++ Examples: 

/*
This example requires only a form.  A Rich Edit control is
created on the form and aligned to take the entire client
area of the form.  A series of lines are written to the Rich
Edit control's Lines property, and the Paragraph property
manipulated such that the first items displayed are bulleted,
a second group of lines are unbulleted and centered, and the
last group is left justified and indented.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  TRichEdit *pRich = new TRichEdit(this);  // The owner will clean this up.
  pRich->Parent = this;
  pRich->Align = alClient;
  pRich->Lines->Clear();
  // set numbering style
  pRich->Paragraph->Numbering = nsBullet;
  pRich->Lines->Add("Introduction");
  pRich->Lines->Add("New members to our team");
  pRich->Lines->Add("New Budget discussion");
  pRich->Lines->Add("Facilities");
  pRich->Lines->Add("Q & A");
  pRich->Paragraph->Numbering = nsNone;
  pRich->Paragraph->Alignment = taCenter;
  pRich->Lines->Add("");
  pRich->Lines->Add("Suggested Topics: ");
  pRich->Lines->Add("");
  pRich->Paragraph->Alignment = taLeftJustify;
  pRich->Paragraph->FirstIndent = 10;
  pRich->Lines->Add("");
  pRich->Lines->Add("Parking lot repair");
  pRich->Lines->Add("Cost overruns");
}

 

Delphi Examples: 

{
This example requires only a form.  A Rich Edit control is
created on the form and aligned to take the entire client
area of the form.  A series of lines are written to the Rich
Edit control's Lines property, and the Paragraph property
manipulated such that the first items displayed are bulleted,
a second group of lines are unbulleted and centered, and the
last group is left justified and indented.
}
uses ComCtrls;

procedure TForm1.FormCreate(Sender: TObject);
begin
  with TRichEdit.Create(Self) do
  begin
    Parent := Self;
    Align := alClient;
    Lines.Clear;
    // set numbering style
    Paragraph.Numbering := nsBullet;
    Lines.Add('Introduction');
    Lines.Add('New members to our team');
    Lines.Add('New Budget discussion');
    Lines.Add('Facilities');
    Lines.Add('Q & A');
    Paragraph.Numbering := nsNone;
    Paragraph.Alignment := taCenter;
    Lines.Add('');
    Lines.Add('Suggested Topics:');
    Lines.Add('');
    Paragraph.Alignment := taLeftJustify;
    Paragraph.FirstIndent := 10;
    Lines.Add('');
    Lines.Add('Parking lot repair');
    Lines.Add('Cost overruns');
  end;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!