function TCustomToolWindow97.GetFloatingBorderSize: TPoint;
{ Returns size of a thick border. Note that, depending on the Windows version,
this may not be the same as the actual window metrics since it draws its
own border }
const
XMetrics:
array[Boolean]
of Integer = (SM_CXDLGFRAME, SM_CXFRAME);
YMetrics:
array[Boolean]
of Integer = (SM_CYDLGFRAME, SM_CYFRAME);
begin
Result.X := GetSystemMetrics(XMetrics[Resizable]);
Result.Y := GetSystemMetrics(YMetrics[Resizable]);
end;
procedure TCustomToolWindow97.GetFloatingNCArea (
var TopLeft, BottomRight: TPoint);
begin
with GetFloatingBorderSize
do begin
TopLeft.X := X;
TopLeft.Y := Y;
if ShowCaption
then
Inc (TopLeft.Y, GetSmallCaptionHeight);
BottomRight.X := X;
BottomRight.Y := Y;
end;
end;
function GetCaptionRect (
const Control: TCustomToolWindow97;
const AdjustForBorder, MinusCloseButton: Boolean): TRect;
begin
Result := Rect(0, 0, Control.ClientWidth, GetSmallCaptionHeight-1);
if MinusCloseButton
then
Dec (Result.Right, Result.Bottom);
if AdjustForBorder
then
with Control.GetFloatingBorderSize
do
OffsetRect (Result, X, Y);
end;
function GetSmallCaptionHeight: Integer;
{ Returns height of the caption of a small window }
begin
if NewStyleControls
then
Result := GetSystemMetrics(SM_CYSMCAPTION)
else
{ Win 3.x doesn't support small captions, so, like Office 97, use the size
of normal captions minus one }
Result := GetSystemMetrics(SM_CYCAPTION) - 1;
end;