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 | |||
prog:lazarus:classes:tcontrols:dimensions [02/09/2024 18:41] thierry [AdjustClientRect] |
prog:lazarus:classes:tcontrols:dimensions [02/09/2024 18:58] (Version actuelle) thierry [TControl.BoundsRect] |
||
---|---|---|---|
Ligne 79: | Ligne 79: | ||
</code> | </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> | ||
+ | |||