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

# TPaintBox

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

Implements a control with a rectangular drawing area using a given Font and Color.

## Declaration

Source position: extctrls.pp line 475

`type TPaintBox = class(TGraphicControl)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure Paint; override;` |  | Draws the content for the control.
`class function GetControlClassDefaultSize; override;` |  | Gets the default size used for new instances of the class.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`property Canvas: TCanvas;` |  | A clipped window into the parent Canvas.
`published`
`property Align: TAlign;` |  | Specifies the placement of the control on its Parent control.
`property Anchors: TAnchors;` |  | The set of anchor definitions for this control.
`property BorderSpacing: TControlBorderSpacing;` |  | Determines the inner and outer border spacing for this control.
`property Color: TColor;` |  | The background color for the control.
`property Constraints: TSizeConstraints;` |  | Contains the minimum and maximum Width and Height for the control.
`property DragCursor: TCursor;` |  | The cursor shape shown during a drag operation.
`property DragMode: TDragMode;` |  | Determines how a drag operation is started for the control.
`property Enabled: Boolean;` |  | Determines whether the control responds to mouse or keyboard input.
`property Font: TFont;` |  | The font to be used for text display in this control.
`property Hint: TTranslateString;` |  | The text to show in the Hint window for the control.
`property ParentColor: Boolean;` |  | Use the Color from the Parent control, when enabled.
`property ParentFont: Boolean;` |  | Indicates if the Font from the Parent control is used in the control.
`property ParentShowHint: Boolean;` |  | If True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.
`property PopupMenu: TPopupMenu;` |  | A context-sensitive menu that pops up when the right mouse button is clicked over this control.
`property ShowHint: Boolean;` |  | Enables Hint display for the control.
`property Visible: Boolean;` |  | Allows the control, and all of its children, to be displayed or hidden.
`property OnChangeBounds: TNotifyEvent;` |  | Event handler signalled when the Bounds for the control have been changed.
`property OnClick: TNotifyEvent;` |  | Notification handler for mouse clicks.
`property OnContextPopup: TContextPopupEvent;` |  | Invoked when a context-sensitive pop-up menu is requested.
`property OnDblClick: TNotifyEvent;` |  | Event handler signalled when a mouse double click occurs in the control.
`property OnDragDrop: TDragDropEvent;` |  | Event handler signalled when an object is dropped onto the control.
`property OnDragOver: TDragOverEvent;` |  | Event handler signalled when a control is dragged over the control instance.
`property OnEndDrag: TEndDragEvent;` |  | Event handler signalled for the end of a drag-drop operation.
`property OnMouseDown: TMouseEvent;` |  | Event handler signalled when a mouse down event is handled for the control.
`property OnMouseEnter: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has entered the control.
`property OnMouseLeave: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has left the control.
`property OnMouseMove: TMouseMoveEvent;` |  | Event handler signalled when the mouse pointer is moved in the control.
`property OnMouseUp: TMouseEvent;` |  | Event handler signalled when a mouse up event is handled for the control.
`property OnMouseWheel: TMouseWheelEvent;` |  | Event handler for mouse wheel turned.
`property OnMouseWheelDown: TMouseWheelUpDownEvent;` |  | Event handler signalled for a downward movement of the mouse wheel.
`property OnMouseWheelUp: TMouseWheelUpDownEvent;` |  | Event handler signalled for an upward movement of the mouse wheel.
`property OnMouseWheelHorz: TMouseWheelEvent;` |  | Event handler signalled for a horizontal movement of the mouse wheel.
`property OnMouseWheelLeft: TMouseWheelUpDownEvent;` |  | Event handler signalled for a leftward movement of the mouse wheel.
`property OnMouseWheelRight: TMouseWheelUpDownEvent;` |  | Event handler signalled for a rightward movement of the mouse wheel.
`property OnPaint: TNotifyEvent;` |  | Event handler signalled to paint the control.
`property OnResize: TNotifyEvent;` |  | Notification handler for a resize of the control.
`property OnStartDrag: TStartDragEvent;` |  | Event handler signalled for the start of a dragging operation.
`end;`

## Inheritance

`TPaintBox` |  | Implements a control with a rectangular drawing area using a given Font and Color.
`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

TPaintBox is a TGraphicControl descendant which implements a control with a rectangular drawing area using a given Font and Color. Like its ancestor, TPaintBox provides a Canvas which is used to draw on the control surface. It provides an overridden Paint method to configure the Pen, Brush, and Font for the Canvas prior to calling the inherited Paint method. Use the OnPaint event handler to perform drawing operations needed for the control.

## See also

TGraphicControl |  | TGraphicControl is the base class for all lightweight controls.
How to use StdCtrls, ComCtrls or ExtCtrls. |  | How to use StdCtrls, ComCtrls or ExtCtrls.