procedure TForm1.WMEraseBkgnd(
var Msg: TWMEraseBkgnd);
var
rc: TRect;
procedure Paint3(
dc: HDC;
const rc: TRect; clr: COLORREF; delta: integer);
var
pen, oldpen: HPen;
begin
pen := CreatePen(PS_SOLID, 0, clr);
try
oldpen := SelectObject(
dc, pen);
try
MoveToEx(
dc, rc.Right - delta, rc.Bottom - 1,
nil);
LineTo(
dc, rc.Right, rc.Bottom - 1 - delta);
inc(delta, 4);
MoveToEx(
dc, rc.Right - delta, rc.Bottom - 1,
nil);
LineTo(
dc, rc.Right, rc.Bottom - 1 - delta);
inc(delta, 4);
MoveToEx(
dc, rc.Right - delta, rc.Bottom - 1,
nil);
LineTo(
dc, rc.Right, rc.Bottom - 1 - delta);
finally
SelectObject(
dc, oldpen);
end;
finally
DeleteObject(pen);
end;
end;
begin
inherited;
Windows.GetClientRect(
Handle, rc);
rc.Left := rc.Right - 12;
rc.Top := rc.Bottom - 12;
Paint3(Msg.DC, rc, GetSysColor(COLOR_3DSHADOW), 2);
Paint3(Msg.DC, rc, GetSysColor(COLOR_3DSHADOW), 3);
Paint3(Msg.DC, rc, GetSysColor(COLOR_3DHILIGHT), 4);
end;
procedure TForm1.WMNcHitTest(
var Msg: TWMNcHitTest);
var
rc: TRect;
pt: TPoint;
begin
Windows.GetClientRect(
Handle, rc);
rc.Left := rc.Right - 12;
rc.Top := rc.Bottom - 12;
pt.x := Msg.XPos;
pt.y := Msg.YPos;
Windows.ScreenToClient(
Handle, pt);
if PtInRect(rc, pt)
then
Msg.Result := HTBOTTOMRIGHT
else
inherited;
end;
procedure TForm1.WMSize(
var Msg: TWMSize);
begin
inherited;
Windows.InvalidateRect(
Handle,
nil, TRUE);
end;