关于Delphi:Delphi – 为什么ExplicitWidth和ExplicitHeight一直出现在.DFM文件中,它是什么?

Delphi - Why does ExplicitWidth and ExplicitHeight keep appearing in .DFM files and what is it?

我们注意到,在检查更新时,我们的.DFM文件添加了ExplicitWidthExplicitHeight属性 - 但我们不知道原因。

我的问题是:

  • 这些属性是什么?
  • 为什么Delphi会自动添加它们?

下面是一个显示添加的ExplicitWidth属性的示例:

1
2
3
4
5
6
7
8
9
10
11
12
object Splitter2: TcxSplitter
    Left = 0
    Top = 292
    Width = 566
    Height = 8
    Cursor = crVSplit
    HotZoneClassName = 'TcxXPTaskBarStyle'
    AlignSplitter = salBottom
    Control = BottomPanel
    Color = clBtnFace
    ExplicitWidth = 8
end


使用DDevExtensions,您可以禁用在dfm中存储这些属性:
http://andy.jgknet.de/blog/?page_id=10

Adds Explicit* property remover to keep DFM files compatible to older Delphi versions


来自谷歌搜索....

原始文章可以在这里找到。

The Explicit properties remember the
previous bounds of a control before
the Align or Anchor properties are
changed from their defaults.

The only time the Explicit properties
are not written is when the Align
property is set back to its default
value of alNone.

This is when the Explicit properties
are actually used by the control to
reset its bounds to what it was
previously.


仅当Delphi的值与默认值不同时,Delphi才会将已发布属性的值添加到DFM文件中。

例如:

1
property ExplicitWidth: Integer read FExplicitWidth write FExplicitWidth default 1;

如果ExplicitWidth值不为1,则将其写入DFM。
如果未定义"default",则任何值都将写入DFM。

TcxSplitter不是标准的Delphi组件,您最好向其作者询问有关属性的用途。