xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-a30d3fba.md
Gets or sets the size of the control.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[SRCategory(ReportStringId.CatLayout)]
[XRLocalizable(true)]
public virtual SizeF SizeF { get; set; }
<SRCategory(ReportStringId.CatLayout)>
<XRLocalizable(True)>
Public Overridable Property SizeF As SizeF
| Type | Description |
|---|---|
| SizeF |
A SizeF value, specifying the control’s width and height.
|
The size of the control is the size of the RectangleF object returned by the XRControl.BoundsF property of this control.
If the control’s XRControl.Parent property returns null ( Nothing in Visual Basic), the control’s width and height are always measured in hundredths of inch. Otherwise, the control belongs to a report, and its width and height are measured in the units set by the XtraReport.ReportUnit property.
Not all descendants of the XRControl class use the SizeF property. For example, the Band class descendants ignore the SizeF property.
Note
Neither the XRControl.HeightF nor the XRControl.WidthF property can be set to a value that is less than 2 units.
The following example demonstrates how to create an XRControl object and set some of its properties at runtime.
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;
}
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 SizeF 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#L31
XRShape control = new XRShape();
control.SizeF = e.Owner.SizeF;
control.LocationF = new System.Drawing.PointF(0, 0);
asp-net-mvc-grid-create-report-based-on-grid-layout/CS/E4755/Controllers/HomeController.cs#L45
XRShape control = new XRShape();
control.SizeF = e.Owner.SizeF;
control.LocationF = new System.Drawing.PointF(0, 0);
reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/CS/Form1.cs#L106
label.LocationF = new PointF(colWidth * i, 0);
label.SizeF = new SizeF(colWidth, 20);
label.Text = ds.Tables[0].Columns[i].Caption;
reporting-web-forms-handle-server-side-errors/CS/DXWebApplication1/Reports/XtraReport3.cs#L64
this.xrLabel1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F);
this.xrLabel1.SizeF = new System.Drawing.SizeF(100F, 23F);
this.xrLabel1.Text = "xrLabel1";
float newHeight = PageHeight - Margins.Top - Margins.Bottom - PageHeader.HeightF - PageFooter.HeightF;
xrPictureBox1.SizeF = new SizeF(newWidth, newHeight);
xrLabel1.WidthF = newWidth;
asp-net-web-forms-grid-create-report-based-on-grid-layout/VB/WebApplication1/Default.aspx.vb#L33
Dim control As New XRShape()
control.SizeF = e.Owner.SizeF
control.LocationF = New System.Drawing.PointF(0, 0)
asp-net-mvc-grid-create-report-based-on-grid-layout/VB/E4755/Controllers/HomeController.vb#L47
Dim control As New XRShape()
control.SizeF = e.Owner.SizeF
control.LocationF = New System.Drawing.PointF(0, 0)
reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/VB/Form1.vb#L100
label.LocationF = New PointF(colWidth * i, 0)
label.SizeF = New SizeF(colWidth, 20)
label.Text = ds.Tables(0).Columns(i).Caption
reporting-web-forms-handle-server-side-errors/VB/DXWebApplication1/Reports/XtraReport3.vb#L62
Me.xrLabel1.Padding = New DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F)
Me.xrLabel1.SizeF = New System.Drawing.SizeF(100F, 23F)
Me.xrLabel1.Text = "xrLabel1"
Dim newHeight As Single = PageHeight - Margins.Top - Margins.Bottom - PageHeader.HeightF - PageFooter.HeightF
xrPictureBox1.SizeF = New SizeF(newWidth, newHeight)
xrLabel1.WidthF = newWidth
See Also