Search code examples
delphidfm

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


We've noticed that when checking in updates, our .DFM files have added ExplicitWidth and ExplicitHeight properties - but we don't know why.

My questions are:

  • What are these properties for?
  • Why are they automatically added by Delphi?

Below is an example showing the added ExplicitWidth property:

object Splitter2: TcxSplitter
    Left = 0
    Top = 292
    Width = 566
    Height = 8
    Cursor = crVSplit
    HotZoneClassName = 'TcxXPTaskBarStyle'
    AlignSplitter = salBottom
    Control = BottomPanel
    Color = clBtnFace
    ExplicitWidth = 8
end

Solution

  • From Googling....

    Original article can be found here.

    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.