Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
prog:lazarus:classes:tcontrols:dimensions [28/08/2024 15:57] thierry [TWMSize.SizeType] |
prog:lazarus:classes:tcontrols:dimensions [02/09/2024 18:58] (Version actuelle) thierry [TControl.BoundsRect] |
||
---|---|---|---|
Ligne 68: | Ligne 68: | ||
</code> | </code> | ||
+ | ==== TControl.BoundsRect ==== | ||
+ | <code pascal> | ||
+ | function TControl.GetBoundsRect: TRect; | ||
+ | begin | ||
+ | Result.Left := FLeft; | ||
+ | Result.Top := FTop; | ||
+ | Result.Right := FLeft+FWidth; | ||
+ | Result.Bottom := FTop+FHeight; | ||
+ | end; | ||
+ | |||
+ | </code> | ||
+ | ==== TControl.ClientToScreen ==== | ||
+ | |||
+ | <code pascal> | ||
+ | {------------------------------------------------------------------------------ | ||
+ | function TControl.ClientToScreen(const APoint: TPoint): TPoint; | ||
+ | ------------------------------------------------------------------------------} | ||
+ | function TControl.ClientToScreen(const APoint: TPoint): TPoint; | ||
+ | var | ||
+ | P : TPoint; | ||
+ | begin | ||
+ | P := ClientOrigin; | ||
+ | Result.X := APoint.X + P.X; | ||
+ | Result.Y := APoint.Y + P.Y; | ||
+ | end; | ||
+ | |||
+ | function TControl.ClientToScreen(const ARect: TRect): TRect; | ||
+ | var | ||
+ | P : TPoint; | ||
+ | begin | ||
+ | P := ClientToScreen(Point(0, 0)); | ||
+ | Result := ARect; | ||
+ | Result.Offset(P); | ||
+ | end; | ||
+ | |||
+ | </code> | ||
+ | |||
+ | |||