[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'ExtCtrls' (#lcl)

# TCustomShape.PtInShape

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

## Declaration

Source position: extctrls.pp line 296

`public function TCustomShape.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.

## Version info

Added in LCL version 4.0.

## See also

TCustomShape.Click |  | Performs actions needed when a mouse click event occurs on the shaped control.
TCustomShape.OnShapeClick |  | Event handler signalled for a mouse click within the shaped control.
TCustomShape.CMShapeHitTest |  | Handles a CM_MASKHITTEST message for the control.
TBitmap |  | Implements a FCL-compatible reader/writer for a Bitmap image.
TPoint