, , . .
:
, , ( , ). , , , .
, . "" "" . , .
, , .
, , , , . , . , ,... , ? .
, / . () , , , . , , , , :
function TForm1.ResizableAt(X, Y: Integer): Boolean;
const
BorderBuffer = 5;
var
R: TRect;
C: TCursor;
begin
SetRect(R, 0, 0, Width, Height);
InflateRect(R, -BorderBuffer, -BorderBuffer);
Result := not PtInRect(R, Point(X, Y));
if Result then
begin
FSides := [];
if X < R.Left then
Include(FSides, sLeft)
else if X > R.Right then
Include(FSides, sRight);
if Y < R.Top then
Include(FSides, sTop)
else if Y > R.Bottom then
Include(FSides, sBottom);
end;
end;
function TForm1.SidesToCursor: TCursor;
begin
if (FSides = [sleft, sTop]) or (FSides = [sRight, sBottom]) then
Result := crSizeNWSE
else if (FSides = [sRight, sTop]) or (FSides = [sLeft, sBottom]) then
Result := crSizeNESW
else if (sLeft in FSides) or (sRight in FSides) then
Result := crSizeWE
else if (sTop in FSides) or (sBottom in FSides) then
Result := crSizeNS
else
Result := crNone;
end;
procedure TForm1.ApplicationEventsMessage(var Msg: tagMSG;
var Handled: Boolean);
var
CommandType: WPARAM;
begin
case Msg.message of
WM_LBUTTONDOWN:
if FResizable then
begin
CommandType := SC_SIZE;
if sLeft in FSides then
Inc(CommandType, WMSZ_LEFT)
else if sRight in FSides then
Inc(CommandType, WMSZ_RIGHT);
if sTop in FSides then
Inc(CommandType, WMSZ_TOP)
else if sBottom in FSides then
Inc(CommandType, WMSZ_BOTTOM);
ReleaseCapture;
DisableAlign;
PostMessage(Handle, WM_SYSCOMMAND, CommandType, 0);
Handled := True;
end;
WM_MOUSEMOVE:
with ScreenToClient(Msg.pt) do
begin
FResizable := ResizableAt(X, Y);
if FResizable then
Screen.Cursor := SidesToCursor
else
Screen.Cursor := Cursor;
if AlignDisabled then
EnableAlign;
end;
end;
end;
: Align = alCustom Anchors = [akLeft, akTop, akRight], , , , , .;)