FrameRect (Delphi)

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, vertical line frame around the rectangle.

Code

procedure TForm1.Button1Click(Sender: TObject);
var TheRect: TRect;
begin
  TheRect := Rect(10,10,100,100);
  Form1.Canvas.TextRect(TheRect,10,10,'Hello, world!');
  Form1.Canvas.Brush.Color := clBlack;
  Form1.Canvas.FrameRect(TheRect);
end;

Uses

Personal tools
Assistance