FrameRect (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code displays the text "Hello, world!" in a rectangle defined by the coordinates (10, 10) and (100, 100). After displaying the text with the TextRect method, the code draws a black line frame around the rectangle.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TRect TheRect = Rect(10,10,100,100);
  Canvas->TextRect(TheRect, 10, 10, "Hello World");
  Canvas->Brush->Color = clBlack;
  Canvas->FrameRect(TheRect);
}

Uses