Sign in Join
FPDoc Onlineexperiment

TCustomShape.PtInShape function

Member of TCustomShapepublicIn unit ExtCtrls

Determines whether the coordinates for the specified Point are within the area for the shaped control.

Declaration

pascal
function PtInShape(const P: TPoint): Boolean

Arguments

P

TPoint instance with the horizontal (X) and vertical (Y) coordinates tested in the method.

Function result

Returns True if the specified coordinates are within the interior of the shape.

Description

PtInShape uses a temporary TBitmap instance to determine whether the coordinates in P are within the interior of the shaped control. The Bitmap contains a monochrome variant of the filled shape where the pixels inside the shape have the color clBlack. Pixels outside of the filled interior area have the mask color for the monochrome bitmap.

The return value is True if the pixel located at the X and Y coordinates in P has the color clBlack. False indicates that the parent control (or a partially obstructed sibling control) was the target under the specified mouse position.

PtInShape is used in the Click method to determine whether an assigned OnShapeClick event handler is signalled for the mouse position on the control. It is also called when CMShapeHitTest handles a TCMHittest message received for the control design surface.

Added in LCL version 4.0.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.