unit FrameRect;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: FrameRect
// Routine: Classes.Rect
// Method: Graphics.TCanvas.TextRect
// Method: Graphics.TCanvas.FrameRect

// BeginCode
{
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.
} 
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;
// EndCode
// EndExample: FrameRect
end.
