From RAD Studio API Documentation
Jump to: navigation, search


destructor Destroy; override;


__fastcall virtual ~TControl();


Type Visibility Source Unit Parent
destructor public
Vcl.Controls TControl


Destroys an instance of TControl.

Do not call Destroy directly in an application. Instead, call Free. Free verifies that the control is not nil, and only then calls Destroy.

Applications should only free controls explicitly when the constructor was called without assigning an owner to the control.

As the control is destroyed, it:

  • Frees the TFont object in its Font property.
  • Calls its inherited destructor.

Override Destroy to free any memory or resources allocated in the Create method. When declaring a Destroy method in a descendent control type, always add the override directive to the declaration and call the inherited Destroy as the last statement in the redeclared method.

When a control is created, Delphi automatically provides exception handling around the constructor call. The destructor is called if an exception escapes from the constructor. This means that the destructor code must be prepared to clean up a partially constructed instance. Check all data fields for zero before disposing of their contents.

See Also