RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomForm.GetClientRect Method

Returns the value of the ClientRect property.

Pascal
function GetClientRect: TRect; override;
C++
virtual __fastcall TRect GetClientRect();

GetClientRect is the protected access function for the ClientRect property. It returns the dimensions of the form window, indented by any scroll bars and menus. 

Override this method to change the way the client area of the form is defined.  

C++ Examples: 

 

/*
The following lines of code draw the top quarter of an arc 
bounded by the current window:
*/
void __fastcall TForm1::FormPaint(TObject *Sender)
{
  TRect R = GetClientRect();  // Gets the rectangular
                              // coordinates of 
                              // the current window.
  Canvas->Arc(R.Left, R.Top, R.Right, R.Bottom, R.Right, R.Top, R.Left, R.Top);
}

 

Delphi Examples: 

{
The following lines of code draw the top quarter of an arc 
bounded by the current window:
} 
procedure TForm1.FormPaint(Sender: TObject);
var
  R: TRect;
begin
  R := GetClientRect;   { Gets the boundaries of the current window }
  Canvas.Arc(R.Left, R.Top, R.Right, R.Bottom, R.Right, R.Top, R.Left, R.Top);
end; 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!