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

# TCustomShape

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Defines a shaped control with an arbitrary geometric shape.

## Declaration

Source position: extctrls.pp line 274

`type TCustomShape = class(TGraphicControl)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`class function GetControlClassDefaultSize; override;` |  | Gets the default size for instances of the control.
`procedure Click; override;` |  | Performs actions needed when a mouse click event occurs on the shaped control.
`procedure CMShapeHitTest(); message;` |  | Handles a CM_MASKHITTEST message for the control.
`procedure DrawToCanvas(); virtual;` |  | Draws the Shape for the control on the specified canvas.
`procedure UpdateMask;` |  | Updates the internal Monochrome bitmap used as a mask to detect mouse click events on the shaped control.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`function PtInShape();` |  | Determines whether the coordinates for the specified Point are within the area for the shaped control.
`procedure Paint; override;` |  | Draws the shape for the control on its Canvas.
`procedure StyleChanged();` |  | Implements an OnChange event handler signalled when the Brush or the Pen on the control has been changed.
`property Brush: TBrush; [rw]` |  | The Brush used to fill the shaped control.
`property Pen: TPen; [rw]` |  | The Pen used to draw lines on the shaped control.
`property Shape: TShapeType; [rw]` |  | Indicates the geometric shape drawn on the shaped control.
`property OnShapeClick: TNotifyEvent; [rw]` |  | Event handler signalled for a mouse click within the shaped control.
`property OnShapePoints: TShapePointsEvent; [rw]` |  | Event handler signalled to get a custom vertices for the shape drawn on the control.
`end;`

## Inheritance

`TCustomShape` |  | Defines a shaped control with an arbitrary geometric shape.
`TGraphicControl` |  | TGraphicControl is the base class for all lightweight controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TCustomShape is a TGraphicControl descendant used to draw the control with an arbitrary geometric shape. The Shape property determines which geometric shape is displayed, and can be one of a series of standard shapes defined in the TShapeType enumeration. The Brush and Pen properties control the fill and line attributes for the shaped control.

TCustomShape is the base class for TShape. Do not create instances of TCustomShape; use TShape instead.

## Version info

Added in LCL version 4.0 as the base class for TShape.

## See also

TShape |  | Implements a shaped control with an arbitrary geometric shape.
TShapeType |  | TShapeType is an enumerated type with values representing standard geometric shapes.
TGraphicControl |  | TGraphicControl is the base class for all lightweight controls.