TRelativePanelDemo 项目分析¶
项目信息¶
- 项目名称: TRelativePanelDemo
- 下载链接: TRelativePanelDemo.rar
- 分析时间: 2026-03-05
文件结构¶
TRelativePanelDemo/
├── Extractor_Icon.ico
├── Project1.py
├── Project1.xml
├── Unit1.py
├── Unit1.pydfm
├── Unit1.sct
├── Unit1.sfm
主程序文件: Project1.py¶
from glcl import *
from Unit1 import *
def main():
Application.Initialize()
Application.Title = 'Project1'
Application.MainFormOnTaskbar = True
Application.Icon.LoadFromFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Extractor_Icon.ico"))
MainForm = Form1(Application)
MainForm.Show()
FreeConsole()
Application.Run()
MainForm.Free()
if __name__ == '__main__':
main()
单元文件: Unit1.py¶
import os
from glcl import *
class Form1(Form):
def __init__(self, owner):
self.Label2 = Label(self)
self.RelativePanel1 = RelativePanel(self)
self.PageControl1 = PageControl(self)
self.TabSheet1 = TabSheet(self)
self.TabSheet2 = TabSheet(self)
self.TabSheet3 = TabSheet(self)
self.Label1 = Label(self)
self.Label3 = Label(self)
self.Label4 = Label(self)
self.Label5 = Label(self)
self.Label6 = Label(self)
self.Label7 = Label(self)
self.Label8 = Label(self)
self.Label9 = Label(self)
self.Label10 = Label(self)
self.Label11 = Label(self)
self.Bevel1 = Bevel(self)
self.cb1AlignLeftWithPanel = CheckBox(self)
self.cb1AlignHorizontalCenterWithPanel = CheckBox(self)
self.cb1AlignRightWithPanel = CheckBox(self)
self.cb1AlignTopWithPanel = CheckBox(self)
self.cb1AlignVerticalCenterWithPanel = CheckBox(self)
self.cb1AlignBottomWithPanel = CheckBox(self)
self.cbx1LeftOf = ComboBox(self)
self.cbx1AlignLeftWith = ComboBox(self)
self.cbx1AlignHorizontalCenterWith = ComboBox(self)
self.cbx1AlignRightWith = ComboBox(self)
self.cbx1RightOf = ComboBox(self)
self.cbx1Above = ComboBox(self)
self.cbx1AlignTopWith = ComboBox(self)
self.cbx1AlignVerticalCenterWith = ComboBox(self)
self.cbx1AlignBottomWith = ComboBox(self)
self.cbx1Below = ComboBox(self)
self.Label12 = Label(self)
self.Label13 = Label(self)
self.Label14 = Label(self)
self.Label15 = Label(self)
self.Label16 = Label(self)
self.Label17 = Label(self)
self.Label18 = Label(self)
self.Label19 = Label(self)
self.Label20 = Label(self)
self.Label21 = Label(self)
self.Bevel2 = Bevel(self)
self.cb2AlignLeftWithPanel = CheckBox(self)
self.cb2AlignHorizontalCenterWithPanel = CheckBox(self)
self.cb2AlignRightWithPanel = CheckBox(self)
self.cb2AlignTopWithPanel = CheckBox(self)
self.cb2AlignVerticalCenterWithPanel = CheckBox(self)
self.cb2AlignBottomWithPanel = CheckBox(self)
self.cbx2LeftOf = ComboBox(self)
self.cbx2AlignLeftWith = ComboBox(self)
self.cbx2AlignHorizontalCenterWith = ComboBox(self)
self.cbx2AlignRightWith = ComboBox(self)
self.cbx2RightOf = ComboBox(self)
self.cbx2Above = ComboBox(self)
self.cbx2AlignTopWith = ComboBox(self)
self.cbx2AlignVerticalCenterWith = ComboBox(self)
self.cbx2AlignBottomWith = ComboBox(self)
self.cbx2Below = ComboBox(self)
self.Label22 = Label(self)
self.Label23 = Label(self)
self.Label24 = Label(self)
self.Label25 = Label(self)
self.Label26 = Label(self)
self.Label27 = Label(self)
self.Label28 = Label(self)
self.Label29 = Label(self)
self.Label30 = Label(self)
self.Label31 = Label(self)
self.Bevel3 = Bevel(self)
self.cb3AlignLeftWithPanel = CheckBox(self)
self.cb3AlignHorizontalCenterWithPanel = CheckBox(self)
self.cb3AlignRightWithPanel = CheckBox(self)
self.cb3AlignTopWithPanel = CheckBox(self)
self.cb3AlignVerticalCenterWithPanel = CheckBox(self)
self.cb3AlignBottomWithPanel = CheckBox(self)
self.cbx3LeftOf = ComboBox(self)
self.cbx3AlignLeftWith = ComboBox(self)
self.cbx3AlignHorizontalCenterWith = ComboBox(self)
self.cbx3AlignRightWith = ComboBox(self)
self.cbx3RightOf = ComboBox(self)
self.cbx3Above = ComboBox(self)
self.cbx3AlignTopWith = ComboBox(self)
self.cbx3AlignVerticalCenterWith = ComboBox(self)
self.cbx3AlignBottomWith = ComboBox(self)
self.cbx3Below = ComboBox(self)
self.Edit1 = Edit(self)
self.Button1 = Button(self)
self.Shape1 = Shape(self)
self.Label32 = Label(self)
self.LoadProps(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Unit1.pydfm"))
# PageControl的标签页1上面相关控件设置事件
self.cbx1LeftOf.OnChange = self.cbxLeftOfChange
self.cbx1AlignHorizontalCenterWith.OnChange = self.cbxAlignHorizontalCenterWithChange
self.cbx1AlignBottomWith.OnChange = self.cbxAlignBottomWithChange
self.cbx1Above.OnChange = self.cbxAboveChange
self.cb1AlignVerticalCenterWithPanel.OnClick = self.cbAlignVerticalCenterWithPanelClick
self.cb1AlignTopWithPanel.OnClick = self.cbAlignTopWithPanelClick
self.cb1AlignRightWithPanel.OnClick = self.cbAlignRightWithPanelClick
self.cb1AlignLeftWithPanel.OnClick = self.cbAlignLeftWithPanelClick
self.cb1AlignHorizontalCenterWithPanel.OnClick = self.cbAlignHorizontalCenterWithPanelClick
self.cb1AlignBottomWithPanel.OnClick = self.cbAlignBottomWithPanelClick
# PageControl的标签页2上面相关控件设置事件
self.cbx2LeftOf.OnChange = self.cbxLeftOfChange
self.cbx2AlignHorizontalCenterWith.OnChange = self.cbxAlignHorizontalCenterWithChange
self.cbx2AlignBottomWith.OnChange = self.cbxAlignBottomWithChange
self.cbx2Above.OnChange = self.cbxAboveChange
self.cb2AlignVerticalCenterWithPanel.OnClick = self.cbAlignVerticalCenterWithPanelClick
self.cb2AlignTopWithPanel.OnClick = self.cbAlignTopWithPanelClick
self.cb2AlignRightWithPanel.OnClick = self.cbAlignRightWithPanelClick
self.cb2AlignLeftWithPanel.OnClick = self.cbAlignLeftWithPanelClick
self.cb2AlignHorizontalCenterWithPanel.OnClick = self.cbAlignHorizontalCenterWithPanelClick
self.cb2AlignBottomWithPanel.OnClick = self.cbAlignBottomWithPanelClick
# PageControl的标签页3上面相关控件设置事件
self.cbx3LeftOf.OnChange = self.cbxLeftOfChange
self.cbx3AlignHorizontalCenterWith.OnChange = self.cbxAlignHorizontalCenterWithChange
self.cbx3AlignBottomWith.OnChange = self.cbxAlignBottomWithChange
self.cbx3Above.OnChange = self.cbxAboveChange
self.cb3AlignVerticalCenterWithPanel.OnClick = self.cbAlignVerticalCenterWithPanelClick
self.cb3AlignTopWithPanel.OnClick = self.cbAlignTopWithPanelClick
self.cb3AlignRightWithPanel.OnClick = self.cbAlignRightWithPanelClick
self.cb3AlignLeftWithPanel.OnClick = self.cbAlignLeftWithPanelClick
self.cb3AlignHorizontalCenterWithPanel.OnClick = self.cbAlignHorizontalCenterWithPanelClick
self.cb3AlignBottomWithPanel.OnClick = self.cbAlignBottomWithPanelClick
# 选择控件的函数,根据当前标签页的页名返回要操作的控件对象
def SelectedControl(self, aComboBox):
if aComboBox.Items[aComboBox.ItemIndex] == 'Edit1':
return self.Edit1
elif aComboBox.Items[aComboBox.ItemIndex] == 'Button1':
return self.Button1
elif aComboBox.Items[aComboBox.ItemIndex] == 'Shape1':
return self.Shape1
# 每个要被操作的控件对象的Tag值是不一样的,根据Tag的值确定某个控件调整它的位置属性
def cbAlignBottomWithPanelClick(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].AlignBottomWithPanel = Sender.Checked
def cbAlignHorizontalCenterWithPanelClick(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].AlignHorizontalCenterWithPanel = Sender.Checked
def cbAlignLeftWithPanelClick(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].AlignLeftWithPanel = Sender.Checked
def cbAlignRightWithPanelClick(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].AlignRightWithPanel = Sender.Checked
def cbAlignTopWithPanelClick(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].AlignTopWithPanel = Sender.Checked
def cbAlignVerticalCenterWithPanelClick(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].AlignVerticalCenterWithPanel = Sender.Checked
def cbxAboveChange(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].Above = self.SelectedControl(Sender)
def cbxAlignBottomWithChange(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].AlignBottomWith = self.SelectedControl(Sender)
def cbxAlignHorizontalCenterWithChange(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].AlignHorizontalCenterWith = self.SelectedControl(Sender)
def cbxLeftOfChange(self, Sender):
self.RelativePanel1.ControlCollection[Sender.Tag].LeftOf = self.SelectedControl(Sender)
设计文件: Unit1.sct¶
def cb1AlignBottomWithPanelClick(Sender):
def cb1AlignHorizontalCenterWithPanelClick(Sender):
def cb1AlignLeftWithPanelClick(Sender):
def cb1AlignRightWithPanelClick(Sender):
def cb1AlignTopWithPanelClick(Sender):
def cb1AlignVerticalCenterWithPanelClick(Sender):
def cbx1AboveChange(Sender):
cbxAboveChange
def cbxAboveChange(Sender):
def cbx1AlignBottomWithChange(Sender):
cbxAlignBottomWithChange
def RelativePanel1DragDrop(Sender, Source, X, Y):
设计文件: Unit1.sfm¶
object Form1: TForm
Left = 0
Top = 0
Caption = 'TRelativePanel'
ClientHeight = 661
ClientWidth = 588
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poScreenCenter
DesignSize = (
588
661)
TextHeight = 15
object Label32: TLabel
Left = 332
Top = 417
Width = 240
Height = 15
Alignment = taRightJustify
Anchors = [akRight, akBottom]
Caption = '* Drag and drop the controls to relocate them'
ExplicitLeft = 265
ExplicitTop = 280
end
object RelativePanel1: TRelativePanel
Left = 16
Top = 52
Width = 556
Height = 285
ControlCollection = <
item
Control = Edit1
AlignBottomWithPanel = False
AlignHorizontalCenterWithPanel = False
AlignLeftWithPanel = False
AlignRightWithPanel = False
AlignTopWithPanel = False
AlignVerticalCenterWithPanel = False
end
item
Control = Button1
AlignBottomWithPanel = False
AlignHorizontalCenterWithPanel = False
AlignLeftWithPanel = False
AlignRightWithPanel = False
AlignTopWithPanel = False
AlignVerticalCenterWithPanel = False
end
item
Control = Shape1
AlignBottomWithPanel = False
AlignHorizontalCenterWithPanel = False
AlignLeftWithPanel = False
AlignRightWithPanel = False
AlignTopWithPanel = False
AlignVerticalCenterWithPanel = False
end>
Anchors = [akLeft, akTop, akRight, akBottom]
TabOrder = 0
OnDragDrop = RelativePanel1DragDrop
DesignSize = (
556
285)
object Edit1: TEdit
Left = 93
Top = 131
Width = 121
Height = 23
Anchors = []
TabOrder = 0
Text = 'Edit1'
end
object Button1: TButton
Tag = 1
Left = 266
Top = 131
Width = 75
Height = 25
Anchors = []
Caption = 'Button1'
TabOrder = 1
end
object Shape1: TShape
Tag = 2
Left = 404
Top = 108
Width = 65
Height = 65
Anchors = []
end
end
object PageControl1: TPageControl
Left = 16
Top = 354
Width = 556
Height = 296
ActivePage = TabSheet1
Anchors = [akLeft, akRight, akBottom]
TabOrder = 1
object TabSheet1: TTabSheet
Caption = ' Edit1 '
object Label1: TLabel
Left = 32
Top = 97
Width = 33
Height = 15
Caption = 'LeftOf'
end
object Label3: TLabel
Left = 32
Top = 129
Width = 73
Height = 15
Caption = 'AlignLeftWith'
end
object Label4: TLabel
Left = 32
Top = 161
Width = 143
Height = 15
Caption = 'AlighHorizontalCenterWith'
end
object Label5: TLabel
Left = 32
Top = 193
Width = 81
Height = 15
Caption = 'AlignRightWith'
end
object Label6: TLabel
Left = 32
Top = 225
Width = 41
Height = 15
Caption = 'RightOf'
end
object Label7: TLabel
Left = 303
Top = 97
Width = 34
Height = 15
Caption = 'Above'
end
object Label8: TLabel
Left = 303
Top = 129
Width = 74
Height = 15
Caption = 'AlignTopWith'
end
object Label9: TLabel
Left = 303
Top = 161
Width = 127
Height = 15
Caption = 'AlighVerticalCenterWith'
end
object Label10: TLabel
Left = 303
Top = 193
Width = 93
Height = 15
Caption = 'AlignBottomWith'
end
object Label11: TLabel
Left = 303
Top = 225
Width = 32
Height = 15
Caption = 'Below'
end
object Bevel1: TBevel
Left = 273
Top = 15
Width = 11
Height = 177
Shape = bsLeftLine
end
object cb1AlignLeftWithPanel: TCheckBox
Left = 16
Top = 15
Width = 243
Height = 17
Caption = 'AlignLeftWithPanel'
TabOrder = 0
OnClick = cb1AlignLeftWithPanelClick
end
object cb1AlignHorizontalCenterWithPanel: TCheckBox
Left = 16
Top = 41
Width = 243
Height = 17
Caption = 'AlignHorizontalCenterWithPanel'
TabOrder = 1
OnClick = cb1AlignHorizontalCenterWithPanelClick
end
object cb1AlignRightWithPanel: TCheckBox
Left = 16
Top = 67
Width = 243
Height = 17
Caption = 'AlignRightWithPanel'
TabOrder = 2
OnClick = cb1AlignRightWithPanelClick
end
object cb1AlignTopWithPanel: TCheckBox
Left = 287
Top = 15
Width = 227
Height = 17
Caption = 'AlignTopWithPanel'
TabOrder = 3
OnClick = cb1AlignTopWithPanelClick
end
object cb1AlignVerticalCenterWithPanel: TCheckBox
Left = 287
Top = 41
Width = 227
Height = 17
Caption = 'AlignVerticalCenterWithPanel'
TabOrder = 4
OnClick = cb1AlignVerticalCenterWithPanelClick
end
object cb1AlignBottomWithPanel: TCheckBox
Left = 287
Top = 67
Width = 227
Height = 17
Caption = 'AlignBottomWithPanel'
TabOrder = 5
OnClick = cb1AlignBottomWithPanelClick
end
object cbx1LeftOf: TComboBox
Left = 189
Top = 94
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 6
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1AlignLeftWith: TComboBox
Left = 189
Top = 126
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 7
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1AlignHorizontalCenterWith: TComboBox
Left = 189
Top = 158
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 8
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1AlignRightWith: TComboBox
Left = 189
Top = 190
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 9
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1RightOf: TComboBox
Left = 189
Top = 222
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 10
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1Above: TComboBox
Left = 448
Top = 94
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 11
Text = '(none)'
OnChange = cbxAboveChange
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1AlignTopWith: TComboBox
Left = 448
Top = 126
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 12
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1AlignVerticalCenterWith: TComboBox
Left = 448
Top = 158
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 13
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1AlignBottomWith: TComboBox
Left = 448
Top = 190
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 14
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
object cbx1Below: TComboBox
Left = 448
Top = 222
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 15
Text = '(none)'
Items.Strings = (
'(none)'
'Button1'
'Shape1')
end
end
object TabSheet2: TTabSheet
Caption = ' Button1 '
ImageIndex = 1
object Label12: TLabel
Left = 32
Top = 97
Width = 33
Height = 15
Caption = 'LeftOf'
end
object Label13: TLabel
Left = 32
Top = 129
Width = 73
Height = 15
Caption = 'AlignLeftWith'
end
object Label14: TLabel
Left = 32
Top = 161
Width = 143
Height = 15
Caption = 'AlighHorizontalCenterWith'
end
object Label15: TLabel
Left = 32
Top = 193
Width = 81
Height = 15
Caption = 'AlignRightWith'
end
object Label16: TLabel
Left = 32
Top = 225
Width = 41
Height = 15
Caption = 'RightOf'
end
object Label17: TLabel
Left = 303
Top = 97
Width = 34
Height = 15
Caption = 'Above'
end
object Label18: TLabel
Left = 303
Top = 129
Width = 74
Height = 15
Caption = 'AlignTopWith'
end
object Label19: TLabel
Left = 303
Top = 161
Width = 127
Height = 15
Caption = 'AlighVerticalCenterWith'
end
object Label20: TLabel
Left = 303
Top = 193
Width = 93
Height = 15
Caption = 'AlignBottomWith'
end
object Label21: TLabel
Left = 303
Top = 225
Width = 32
Height = 15
Caption = 'Below'
end
object Bevel2: TBevel
Left = 273
Top = 15
Width = 11
Height = 177
Shape = bsLeftLine
end
object cb2AlignLeftWithPanel: TCheckBox
Tag = 1
Left = 16
Top = 15
Width = 243
Height = 17
Caption = 'AlignLeftWithPanel'
TabOrder = 0
end
object cb2AlignHorizontalCenterWithPanel: TCheckBox
Tag = 1
Left = 16
Top = 41
Width = 243
Height = 17
Caption = 'AlignHorizontalCenterWithPanel'
TabOrder = 1
end
object cb2AlignRightWithPanel: TCheckBox
Tag = 1
Left = 16
Top = 67
Width = 243
Height = 17
Caption = 'AlignRightWithPanel'
TabOrder = 2
end
object cb2AlignTopWithPanel: TCheckBox
Tag = 1
Left = 287
Top = 15
Width = 227
Height = 17
Caption = 'AlignTopWithPanel'
TabOrder = 3
end
object cb2AlignVerticalCenterWithPanel: TCheckBox
Tag = 1
Left = 287
Top = 41
Width = 227
Height = 17
Caption = 'AlignVerticalCenterWithPanel'
TabOrder = 4
end
object cb2AlignBottomWithPanel: TCheckBox
Tag = 1
Left = 287
Top = 67
Width = 227
Height = 17
Caption = 'AlignBottomWithPanel'
TabOrder = 5
end
object cbx2LeftOf: TComboBox
Tag = 1
Left = 189
Top = 94
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 6
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2AlignLeftWith: TComboBox
Tag = 1
Left = 189
Top = 126
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 7
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2AlignHorizontalCenterWith: TComboBox
Tag = 1
Left = 189
Top = 158
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 8
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2AlignRightWith: TComboBox
Tag = 1
Left = 189
Top = 190
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 9
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2RightOf: TComboBox
Tag = 1
Left = 189
Top = 222
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 10
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2Above: TComboBox
Tag = 1
Left = 448
Top = 94
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 11
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2AlignTopWith: TComboBox
Tag = 1
Left = 448
Top = 126
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 12
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2AlignVerticalCenterWith: TComboBox
Tag = 1
Left = 448
Top = 158
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 13
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2AlignBottomWith: TComboBox
Tag = 1
Left = 448
Top = 190
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 14
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
object cbx2Below: TComboBox
Tag = 1
Left = 448
Top = 222
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 15
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Shape1')
end
end
object TabSheet3: TTabSheet
Caption = ' Shape1 '
ImageIndex = 2
object Label22: TLabel
Left = 32
Top = 97
Width = 33
Height = 15
Caption = 'LeftOf'
end
object Label23: TLabel
Left = 32
Top = 129
Width = 73
Height = 15
Caption = 'AlignLeftWith'
end
object Label24: TLabel
Left = 32
Top = 161
Width = 143
Height = 15
Caption = 'AlighHorizontalCenterWith'
end
object Label25: TLabel
Left = 32
Top = 193
Width = 81
Height = 15
Caption = 'AlignRightWith'
end
object Label26: TLabel
Left = 32
Top = 225
Width = 41
Height = 15
Caption = 'RightOf'
end
object Label27: TLabel
Left = 303
Top = 97
Width = 34
Height = 15
Caption = 'Above'
end
object Label28: TLabel
Left = 303
Top = 129
Width = 74
Height = 15
Caption = 'AlignTopWith'
end
object Label29: TLabel
Left = 303
Top = 161
Width = 127
Height = 15
Caption = 'AlighVerticalCenterWith'
end
object Label30: TLabel
Left = 303
Top = 193
Width = 93
Height = 15
Caption = 'AlignBottomWith'
end
object Label31: TLabel
Left = 303
Top = 225
Width = 32
Height = 15
Caption = 'Below'
end
object Bevel3: TBevel
Left = 273
Top = 15
Width = 11
Height = 177
Shape = bsLeftLine
end
object cb3AlignLeftWithPanel: TCheckBox
Tag = 2
Left = 16
Top = 15
Width = 243
Height = 17
Caption = 'AlignLeftWithPanel'
TabOrder = 0
end
object cb3AlignHorizontalCenterWithPanel: TCheckBox
Tag = 2
Left = 16
Top = 41
Width = 243
Height = 17
Caption = 'AlignHorizontalCenterWithPanel'
TabOrder = 1
end
object cb3AlignRightWithPanel: TCheckBox
Tag = 2
Left = 16
Top = 67
Width = 243
Height = 17
Caption = 'AlignRightWithPanel'
TabOrder = 2
end
object cb3AlignTopWithPanel: TCheckBox
Tag = 2
Left = 287
Top = 15
Width = 231
Height = 17
Caption = 'AlignTopWithPanel'
TabOrder = 3
end
object cb3AlignVerticalCenterWithPanel: TCheckBox
Tag = 2
Left = 287
Top = 41
Width = 231
Height = 17
Caption = 'AlignVerticalCenterWithPanel'
TabOrder = 4
end
object cb3AlignBottomWithPanel: TCheckBox
Tag = 2
Left = 287
Top = 67
Width = 231
Height = 17
Caption = 'AlignBottomWithPanel'
TabOrder = 5
end
object cbx3LeftOf: TComboBox
Tag = 2
Left = 189
Top = 94
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 6
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3AlignLeftWith: TComboBox
Tag = 2
Left = 189
Top = 126
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 7
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3AlignHorizontalCenterWith: TComboBox
Tag = 2
Left = 189
Top = 158
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 8
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3AlignRightWith: TComboBox
Tag = 2
Left = 189
Top = 190
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 9
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3RightOf: TComboBox
Tag = 2
Left = 189
Top = 222
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 10
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3Above: TComboBox
Tag = 2
Left = 448
Top = 94
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 11
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3AlignTopWith: TComboBox
Tag = 2
Left = 448
Top = 126
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 12
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3AlignVerticalCenterWith: TComboBox
Tag = 2
Left = 448
Top = 158
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 13
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3AlignBottomWith: TComboBox
Tag = 2
Left = 448
Top = 190
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 14
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
object cbx3Below: TComboBox
Tag = 2
Left = 448
Top = 222
Width = 70
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 15
Text = '(none)'
Items.Strings = (
'(none)'
'Edit1'
'Button1')
end
end
end
end
其他文件¶
- Extractor_Icon.ico
- Project1.xml
详细分析¶
功能概述¶
GUI组件演示
使用的组件¶
- Form1 (TForm)
- Label32 (TLabel)
- RelativePanel1 (TRelativePanel)
- Edit1 (TEdit)
- Button1 (TButton)
- Shape1 (TShape)
- PageControl1 (TPageControl)
- TabSheet1 (TTabSheet)
- Label1 (TLabel)
- Label3 (TLabel)
- Label4 (TLabel)
- Label5 (TLabel)
- Label6 (TLabel)
- Label7 (TLabel)
- Label8 (TLabel)
- Label9 (TLabel)
- Label10 (TLabel)
- Label11 (TLabel)
- Bevel1 (TBevel)
- cb1AlignLeftWithPanel (TCheckBox)
- cb1AlignHorizontalCenterWithPanel (TCheckBox)
- cb1AlignRightWithPanel (TCheckBox)
- cb1AlignTopWithPanel (TCheckBox)
- cb1AlignVerticalCenterWithPanel (TCheckBox)
- cb1AlignBottomWithPanel (TCheckBox)
- cbx1LeftOf (TComboBox)
- cbx1AlignLeftWith (TComboBox)
- cbx1AlignHorizontalCenterWith (TComboBox)
- cbx1AlignRightWith (TComboBox)
- cbx1RightOf (TComboBox)
- cbx1Above (TComboBox)
- cbx1AlignTopWith (TComboBox)
- cbx1AlignVerticalCenterWith (TComboBox)
- cbx1AlignBottomWith (TComboBox)
- cbx1Below (TComboBox)
- TabSheet2 (TTabSheet)
- Label12 (TLabel)
- Label13 (TLabel)
- Label14 (TLabel)
- Label15 (TLabel)
- Label16 (TLabel)
- Label17 (TLabel)
- Label18 (TLabel)
- Label19 (TLabel)
- Label20 (TLabel)
- Label21 (TLabel)
- Bevel2 (TBevel)
- cb2AlignLeftWithPanel (TCheckBox)
- cb2AlignHorizontalCenterWithPanel (TCheckBox)
- cb2AlignRightWithPanel (TCheckBox)
- cb2AlignTopWithPanel (TCheckBox)
- cb2AlignVerticalCenterWithPanel (TCheckBox)
- cb2AlignBottomWithPanel (TCheckBox)
- cbx2LeftOf (TComboBox)
- cbx2AlignLeftWith (TComboBox)
- cbx2AlignHorizontalCenterWith (TComboBox)
- cbx2AlignRightWith (TComboBox)
- cbx2RightOf (TComboBox)
- cbx2Above (TComboBox)
- cbx2AlignTopWith (TComboBox)
- cbx2AlignVerticalCenterWith (TComboBox)
- cbx2AlignBottomWith (TComboBox)
- cbx2Below (TComboBox)
- TabSheet3 (TTabSheet)
- Label22 (TLabel)
- Label23 (TLabel)
- Label24 (TLabel)
- Label25 (TLabel)
- Label26 (TLabel)
- Label27 (TLabel)
- Label28 (TLabel)
- Label29 (TLabel)
- Label30 (TLabel)
- Label31 (TLabel)
- Bevel3 (TBevel)
- cb3AlignLeftWithPanel (TCheckBox)
- cb3AlignHorizontalCenterWithPanel (TCheckBox)
- cb3AlignRightWithPanel (TCheckBox)
- cb3AlignTopWithPanel (TCheckBox)
- cb3AlignVerticalCenterWithPanel (TCheckBox)
- cb3AlignBottomWithPanel (TCheckBox)
- cbx3LeftOf (TComboBox)
- cbx3AlignLeftWith (TComboBox)
- cbx3AlignHorizontalCenterWith (TComboBox)
- cbx3AlignRightWith (TComboBox)
- cbx3RightOf (TComboBox)
- cbx3Above (TComboBox)
- cbx3AlignTopWith (TComboBox)
- cbx3AlignVerticalCenterWith (TComboBox)
- cbx3AlignBottomWith (TComboBox)
- cbx3Below (TComboBox)
技术特点¶
- 包含91个GUI组件
- 定义30个事件处理
窗体属性¶
- caption: AlignBottomWithPanel
- height: 661
- width: 588
代码分析¶
导入的模块: - import os - from glcl import *
定义的类: - Form1
定义的方法: - init - SelectedControl - cbAlignBottomWithPanelClick - cbAlignHorizontalCenterWithPanelClick - cbAlignLeftWithPanelClick - cbAlignRightWithPanelClick - cbAlignTopWithPanelClick - cbAlignVerticalCenterWithPanelClick - cbxAboveChange - cbxAlignBottomWithChange - cbxAlignHorizontalCenterWithChange - cbxLeftOfChange
事件绑定: - self.cbx1LeftOf.OnChange = self.cbxLeftOfChange - self.cbx1AlignHorizontalCenterWith.OnChange = self.cbxAlignHorizontalCenterWithChange - self.cbx1AlignBottomWith.OnChange = self.cbxAlignBottomWithChange - self.cbx1Above.OnChange = self.cbxAboveChange - self.cb1AlignVerticalCenterWithPanel.OnClick = self.cbAlignVerticalCenterWithPanelClick - self.cb1AlignTopWithPanel.OnClick = self.cbAlignTopWithPanelClick - self.cb1AlignRightWithPanel.OnClick = self.cbAlignRightWithPanelClick - self.cb1AlignLeftWithPanel.OnClick = self.cbAlignLeftWithPanelClick - self.cb1AlignHorizontalCenterWithPanel.OnClick = self.cbAlignHorizontalCenterWithPanelClick - self.cb1AlignBottomWithPanel.OnClick = self.cbAlignBottomWithPanelClick - self.cbx2LeftOf.OnChange = self.cbxLeftOfChange - self.cbx2AlignHorizontalCenterWith.OnChange = self.cbxAlignHorizontalCenterWithChange - self.cbx2AlignBottomWith.OnChange = self.cbxAlignBottomWithChange - self.cbx2Above.OnChange = self.cbxAboveChange - self.cb2AlignVerticalCenterWithPanel.OnClick = self.cbAlignVerticalCenterWithPanelClick - self.cb2AlignTopWithPanel.OnClick = self.cbAlignTopWithPanelClick - self.cb2AlignRightWithPanel.OnClick = self.cbAlignRightWithPanelClick - self.cb2AlignLeftWithPanel.OnClick = self.cbAlignLeftWithPanelClick - self.cb2AlignHorizontalCenterWithPanel.OnClick = self.cbAlignHorizontalCenterWithPanelClick - self.cb2AlignBottomWithPanel.OnClick = self.cbAlignBottomWithPanelClick - self.cbx3LeftOf.OnChange = self.cbxLeftOfChange - self.cbx3AlignHorizontalCenterWith.OnChange = self.cbxAlignHorizontalCenterWithChange - self.cbx3AlignBottomWith.OnChange = self.cbxAlignBottomWithChange - self.cbx3Above.OnChange = self.cbxAboveChange - self.cb3AlignVerticalCenterWithPanel.OnClick = self.cbAlignVerticalCenterWithPanelClick - self.cb3AlignTopWithPanel.OnClick = self.cbAlignTopWithPanelClick - self.cb3AlignRightWithPanel.OnClick = self.cbAlignRightWithPanelClick - self.cb3AlignLeftWithPanel.OnClick = self.cbAlignLeftWithPanelClick - self.cb3AlignHorizontalCenterWithPanel.OnClick = self.cbAlignHorizontalCenterWithPanelClick - self.cb3AlignBottomWithPanel.OnClick = self.cbAlignBottomWithPanelClick