AutoSize (C++)

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

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Label1->AutoSize = false;
  Label1->Caption = "This string is too long to be the caption of this label";
}

Uses