Vcl.ExtCtrls.TCustomPanel.CanAutoSize

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override;

C++

virtual bool __fastcall CanAutoSize(int &NewWidth, int &NewHeight);

Properties

Type Visibility Source Unit Parent
function protected
Vcl.ExtCtrls.pas
Vcl.ExtCtrls.hpp
Vcl.ExtCtrls TCustomPanel

Description

Adjusts the way the panel responds to resize attempts.

CanAutoSize is called automatically when the AutoSize property is true and an attempt is made to resize the panel. It allows the panel to implement the AutoSize property before the resize sequence that begins with the OnCanResize and OnConstrainedResize events and ends with the OnResize event.

When CanAutoSize is called, the NewWidth and NewHeight parameters indicate the proposed new dimensions of the panel. CanAutoSize adjusts these values so that the panel's size adjusts to its contents. If the adjustment results in values of NewWidth and NewHeight that differ from the panel's current width and height, CanAutoSize returns true, indicating that the resize sequence should proceed. If, after adjustment, NewWidth and NewHeight equal Width and Height, CanAutoSize returns false, and the resize sequence is aborted.

See Also