AutoSize (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code keeps the size of the label control constant, even though the length of the label�s caption changes. As a result, the caption of the label is probably too long to display in the label when you click the button:

Code

procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.AutoSize := False;
  Label1.Caption := 
    'This string is too long to be the caption of this label';
end;

Uses