Back to Devexpress

XRControl.LocationF Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-c5c8d18a.md

latest8.7 KB
Original Source

XRControl.LocationF Property

Specifies the floating-point representation of the coordinates of the control’s upper-left corner.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[Browsable(false)]
public virtual PointF LocationF { get; set; }
vb
<Browsable(False)>
Public Overridable Property LocationF As PointF

Property Value

TypeDescription
PointF

A PointF value, specifying the upper-left corner of the control.

|

Remarks

The control’s upper-left corner is the upper-left corner of the Rectangle object returned by the XRControl.BoundsF property.

A control’s location coordinates within a report are measured in the units set by the XtraReport.ReportUnit property.

A control’s location is determined in reference to the upper-left corner of the XRControl object, returned by the control’s XRControl.Parent property. If this property returns null ( Nothing in Visual Basic), the control’s coordinates are always measured in hundredths of inch.

Not all descendants of the XRControl class use the LocationF property. For example, the Band class descendants ignore the LocationF property.

Example

The following example demonstrates how to create an XRControl object and set some of its properties at runtime.

csharp
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...

public XRControl CreateMyXRControl() {
    // Create a control.
    XRControl xrControl1 = new XRControl();

    // Set its background color.
    xrControl1.BackColor = Color.LightGray;

    // Set its border color.
    xrControl1.BorderColor = Color.Blue;

    // Make its left and right borders visible.
    xrControl1.Borders = DevExpress.XtraPrinting.BorderSide.Left |
        DevExpress.XtraPrinting.BorderSide.Right;

    // Set its border width (in pixels).
    xrControl1.BorderWidth = 10;

    // Set its location and size (in hundredths of an inch).
    xrControl1.LocationF = new PointF(200F, 100F);
    xrControl1.SizeF = new SizeF(300F, 150F);

    return xrControl1;
}
vb
Imports System.Drawing
Imports DevExpress.XtraReports.UI
' ...

Private Function CreateMyXRControl()
    ' Create a control.
    Dim xrControl1 As New XRControl()

    ' Set its background color.
    xrControl1.BackColor = Color.LightGray

    ' Set its border color.
    xrControl1.BorderColor = Color.Blue

    ' Make its left and right borders visible.
    xrControl1.Borders = DevExpress.XtraPrinting.BorderSide.Left Or _ 
        DevExpress.XtraPrinting.BorderSide.Right

    ' Set its border width (in pixels).
    xrControl1.BorderWidth = 10

    ' Set its location and size (in hundredths of an inch).
    xrControl1.Location = New Point(200, 100)
    xrControl1.SizeF = new SizeF(300F,150F)

    Return xrControl1
End Function

The following code snippets (auto-collected from DevExpress Examples) contain references to the LocationF property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-web-forms-grid-create-report-based-on-grid-layout/CS/WebApplication1/Default.aspx.cs#L32

csharp
control.SizeF = e.Owner.SizeF;
control.LocationF = new System.Drawing.PointF(0, 0);
e.Owner.Controls.Add(control);

asp-net-mvc-grid-create-report-based-on-grid-layout/CS/E4755/Controllers/HomeController.cs#L46

csharp
control.SizeF = e.Owner.SizeF;
control.LocationF = new System.Drawing.PointF(0, 0);
e.Owner.Controls.Add(control);

reporting-winforms-create-table-at-runtime/CS/TableReport.cs#L46

csharp
XRTable table = ((XRTable)sender);
table.LocationF = new DevExpress.Utils.PointFloat(0F, 0F);
table.WidthF = this.PageWidth - this.Margins.Left - this.Margins.Right;

winforms-create-a-custom-exporter-for-pivotgridcontrol-with-xtrareport/CS/Report_at_Runtime/PivotReportGenerator.cs#L205

csharp
detail = InitXRTable(font, true);
header.LocationF = location;
detail.LocationF = location;

reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/CS/Form1.cs#L105

csharp
label.LocationF = new PointF(colWidth * i, 0);
label.SizeF = new SizeF(colWidth, 20);

asp-net-mvc-grid-create-report-based-on-grid-layout/VB/E4755/Controllers/HomeController.vb#L48

vb
control.SizeF = e.Owner.SizeF
control.LocationF = New System.Drawing.PointF(0, 0)
e.Owner.Controls.Add(control)

asp-net-web-forms-grid-create-report-based-on-grid-layout/VB/WebApplication1/Default.aspx.vb#L34

vb
control.SizeF = e.Owner.SizeF
control.LocationF = New System.Drawing.PointF(0, 0)
e.Owner.Controls.Add(control)

reporting-winforms-create-table-at-runtime/VB/TableReport.vb#L47

vb
Dim table As XRTable = (DirectCast(sender, XRTable))
table.LocationF = New DevExpress.Utils.PointFloat(0F, 0F)
table.WidthF = Me.PageWidth - Me.Margins.Left - Me.Margins.Right

winforms-create-a-custom-exporter-for-pivotgridcontrol-with-xtrareport/VB/Report_at_Runtime/PivotReportGenerator.vb#L209

vb
detail = PivotReportGenerator.InitXRTable(font, True)
header.LocationF = location
detail.LocationF = location

reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/VB/Form1.vb#L99

vb
label.LocationF = New PointF(colWidth * i, 0)
label.SizeF = New SizeF(colWidth, 20)

See Also

BoundsF

SizeF

ReportUnit

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace