A
Adnil
Unregistered / Unconfirmed
GUEST, unregistred user!
TMyEdit是一个TEdit和一个TUpDown的组合,Create构造函数大致如下:
FEdit := TEdit.Create(Self);
FEdit.Parent := Self;
FUpDown := TUpDown.Create(Self);
FUpDown.Parent := Self;
FUpDown.Associate := FEdit;
注册组件后发现Edit的属性被存储了两次,dfm文件如下:
object MyEdit1: TMyEdit
Left = 252
Top = 256
Caption = 'MyEdit1'
TabOrder = 1
Edit.Left = 0
Edit.Top = 0
Edit.Width = 60
Edit.Height = 16
Edit.TabOrder = 0
Edit.Text = '0'
UpDown.Left = 60
UpDown.Top = 0
UpDown.Width = 16
UpDown.Height = 16
UpDown.Associate.Left = 0 //为什么Associate的属性又保存了一遍?
UpDown.Associate.Top = 0
UpDown.Associate.Width = 60
UpDown.Associate.Height = 16
UpDown.Associate.TabOrder = 0
UpDown.Associate.Text = '0'
UpDown.Min = 0
UpDown.Position = 0
UpDown.TabOrder = 1
UpDown.Wrap = False
end
FEdit := TEdit.Create(Self);
FEdit.Parent := Self;
FUpDown := TUpDown.Create(Self);
FUpDown.Parent := Self;
FUpDown.Associate := FEdit;
注册组件后发现Edit的属性被存储了两次,dfm文件如下:
object MyEdit1: TMyEdit
Left = 252
Top = 256
Caption = 'MyEdit1'
TabOrder = 1
Edit.Left = 0
Edit.Top = 0
Edit.Width = 60
Edit.Height = 16
Edit.TabOrder = 0
Edit.Text = '0'
UpDown.Left = 60
UpDown.Top = 0
UpDown.Width = 16
UpDown.Height = 16
UpDown.Associate.Left = 0 //为什么Associate的属性又保存了一遍?
UpDown.Associate.Top = 0
UpDown.Associate.Width = 60
UpDown.Associate.Height = 16
UpDown.Associate.TabOrder = 0
UpDown.Associate.Text = '0'
UpDown.Min = 0
UpDown.Position = 0
UpDown.TabOrder = 1
UpDown.Wrap = False
end