Delphi Specify the Alignment of a Control using Align or TAlign

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
Specify the Alignment of a Control using Align or TAlign
By Muhammad Azizul Hakim June 30, 2021

Align or TAlign is used to specify the alignment of control within its parent. TAlign specifies how control is placed relative to its parent.

It can have one of the following values:

ValueMeaning
alNoneThe control remains where it was placed. This is the default value.
alTopThe 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.
alBottomThe 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.
alLeftThe 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.
alRightThe 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.
alClientThe 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.
alCustomThe control’s positioning is determined by calls to its parent’s CustomAlignInsertBefore and CustomAlignPosition methods.
Here is the working example of the implementation of Align in MainPanel creation:
Python:
def __init__(self, Owner):
    self.Caption = "Components Overview Sample"
    self.Name = "BaseForm"
    self.SetBounds(10, 10, 700, 650)
    # Main panel creation
    pnlMain = CreateComponent('TPanel',Owner)
    pnlMain.SetProps(Parent=self, Caption="",align = "alClient", Name = "MainPanel")
Here is the working example of the implementation of Align in PageControl creation:
Python:
# Page control creation
pgConMain = PageControl(pnlMain)
pgConMain.Name = "MyPageControl"
pgConMain.Parent = pnlMain
pgConMain.Align = "alClient"
See the complete code Для просмотра ссылки Войди или Зарегистрируйся.