1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
procedure TFMain.WMNCHitTest(var msg: TWMNCHittest);
var
pt: TPoint;
begin
inherited;
pt := ScreenToClient(Point(msg.XPos, msg.YPos));
{ if PtInRect(Rect(0, 0, ClientWidth - 4, 20), pt) then
msg.Result := HTCAPTION // déplacement
else }
if PtInRect(Rect(-4, -4, 4, 4), pt) then
msg.Result := HTTOPLEFT // redimensionnement gauche-haut
else
if PtInRect(Rect(ClientWidth - 4, -4, ClientWidth, 4), pt) then
msg.Result := HTTOPRIGHT // redimensionnement par droite-haut
else
if PtInRect(Rect(-4, 4, 4, ClientHeight - 4), pt) then
msg.Result := HTLEFT // redimensionnement gauche
else
if PtInRect(Rect(-4, ClientHeight - 4, 4, ClientHeight), pt) then
msg.Result := HTBOTTOMLEFT // redimensionnement par gauche-bas
else
if PtInRect(Rect(0, -4, ClientWidth, 4), pt) then
msg.Result := HTTOP // redimensionnement par le haut
else
if PtInRect(Rect(ClientWidth - 4, 4, ClientWidth, ClientHeight - 4), pt) then
msg.Result := HTRIGHT // redimensionnement droit
else
if PtInRect(Rect(ClientWidth - 4, ClientHeight - 4, ClientWidth, ClientHeight), pt) then
msg.Result := HTBOTTOMRIGHT // redimensionnement par droit-bas
else
if PtInRect(Rect(4, ClientHeight - 4, ClientWidth - 4, ClientHeight), pt) then
msg.Result := HTBOTTOM; // redimensionnement par le bas
end;
à noter que du fait du MouseDown, le HTCAPTION n'a plus d'intérêt, sauf si on veut limiter le déplacement en cliquant dans le haut..
encore bravo pour cette piste !
@bientôt |
Partager