From RAD Studio API Documentation
Jump to: navigation, search



TMargins = class(TPersistent)


class PASCALIMPLEMENTATION TMargins : public System::Classes::TPersistent


Type Visibility Source Unit Parent
class public
Vcl.Controls Vcl.Controls


Contains margins for the control.

TMargins is used in the Margins property of TControl and its descendants. TMargins help define the relative position between components on a form, and between the edges of the form and the component. For example, when you set a left margin for a component to 10 pixels, the component will not come closer than 10 pixels to the edge of the container, or to another component on the left edge. The number of pixels by which two components are separated is the sum of the pixels of both components.

For example, if you place a component on the form with a left margin of 10 pixels, then add another component to its left with a right margin of 20 pixels, the closest the two components can come together on those edges is 30 pixels.

You can define the amount of margin that should surround the component on the top, left, bottom, or right by changing the pixel value for the Margins property in the Object Inspector.

Note: For the Margins settings to take effect on a component, you must also set its AlignWithMargins property to True.

Code Examples