# Element Offset Calculations

## Location Offset Factors

The factors that produce the location offset of an element relative to its parent are:

1. Location of the rectangle fed to the child Arrange method.

2. Parent border thickness.

3. Parent padding.

4. Child margin.

5. Child location.

6. Child alignment.

7. Child PositionOffset.

There are multiple properties storing offsets and bounds of an element. The sum of items 1 through 6 produces the **LayoutOffset**. The sum of items 1 through 7 inclusive produces the offset as stored in the RadElement **TransformationMatrix**.

## LayoutOffset

The RadElement **LayoutOffset** is the sum of the arrange rectangle offset, parent border, padding, child margin, child location and alignment. In the figure below the "Final Rect Offset" illustrates the offset of the arrange rectangle where parent content is rendered. "Layout offset" indicates the offset represented by the **LayoutOffset** property.

![Telerik UI for WinForms Telerik Presentation Framework LayoutOffset diagram showing arrange, border, padding, margin, location, and alignment offsets](https://www.telerik.com/products/winforms/documentation/assets/75e772f2b1e989303c833e878c34ba67/tpf-layout-element-offset-calculations001.png)

## PositionOffset

The offset of the origin of the coordinate system used when painting an element and its children. The **PositionOffset** is relative to the parent of an element. Setting **PositionOffset** has no influence on other layout properties and is only used to paint the element using an offset. The area of the element appearing outside of the parent bounds is clipped.

The example below shows a FillPrimitive where the **PositionOffset** is 5 pixels down and 5 pixels in.

![Telerik UI for WinForms Telerik Presentation Framework PositionOffset example showing a FillPrimitive shifted down and right](https://www.telerik.com/products/winforms/documentation/assets/dc0ab08b48270780b31c314f5bedf844/tpf-layout-element-offset-calculations002.png)

#### Setting PositionOffset

 

 

```C#
BorderPrimitive rectanglePrimitive = new BorderPrimitive();
rectanglePrimitive.ForeColor = Color.Red;
rectanglePrimitive.MinSize = new Size(20, 20);
rectanglePrimitive.PositionOffset = new SizeF(15, 15);

```

```VB.NET
Dim rectanglePrimitive As New BorderPrimitive()
rectanglePrimitive.ForeColor = Color.Red
rectanglePrimitive.MinSize = New Size(20, 20)
rectanglePrimitive.PositionOffset = New SizeF(15, 15)

```



## See Also

* [Clipping](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/layout/clipping)

* [Custom Layouts](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/layout/custom-layouts)

* [Layout Activation](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/layout/layout-activation)

* [Layout Logic](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/layout/layout-logic)

* [Layout Overview](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/layout/layout-overview)

* [Layout Structure](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/layout/layout-structure)

* [RadControl Testing Considerations](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/layout/radcontrol-testing-considerations)

* [Sample Arrange Stage Scenarios](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/layout/sample-arrange-stage-scenarios)
