Class ComponentBase
Class that implements some object's properties such as location, size and visibility.
Implements
Inherited Members
Namespace: FastReport
Assembly: FastReport.Base.dll
Syntax
public abstract class ComponentBase : Base, IFRSerializable
Constructors
ComponentBase()
Initializes a new instance of the ComponentBase class with default settings.
Declaration
public ComponentBase()
Properties
AbsBottom
Gets the absolute bottom coordinate of the object.
Declaration
public float AbsBottom { get; }
Property Value
Type | Description |
---|---|
System.Single |
AbsBounds
Gets the absolute bounding rectangle of the object.
Declaration
public RectangleF AbsBounds { get; }
Property Value
Type | Description |
---|---|
RectangleF |
AbsLeft
Gets the absolute left coordinate of the object.
Declaration
public virtual float AbsLeft { get; }
Property Value
Type | Description |
---|---|
System.Single |
AbsRight
Gets the absolute right coordinate of the object.
Declaration
public float AbsRight { get; }
Property Value
Type | Description |
---|---|
System.Single |
AbsTop
Gets the absolute top coordinate of the object.
Declaration
public virtual float AbsTop { get; }
Property Value
Type | Description |
---|---|
System.Single |
Anchor
Gets or sets the edges of the container to which a control is bound and determines how a control is resized with its parent.
Declaration
public virtual AnchorStyles Anchor { get; set; }
Property Value
Type | Description |
---|---|
AnchorStyles |
Remarks
Use the Anchor property to define how a control is automatically resized as its parent control is resized. Anchoring a control to its parent control ensures that the anchored edges remain in the same position relative to the edges of the parent control when the parent control is resized.
You can anchor a control to one or more edges of its container. For example, if you have a band with a TextObject whose Anchor property value is set to Top, Bottom, the TextObject is stretched to maintain the anchored distance to the top and bottom edges of the band as the height of the band is increased.
Bottom
Gets the bottom coordinate of the object in relation to its container.
Declaration
public float Bottom { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
Bounds
Gets or sets the bounding rectangle of the object.
Declaration
public RectangleF Bounds { get; set; }
Property Value
Type | Description |
---|---|
RectangleF |
Remarks
Assigning a value to this property is equal to assigning values to the Left, Top, Width, Height properties.
ClientSize
Gets or sets the size of client area of the object.
Declaration
public virtual SizeF ClientSize { get; set; }
Property Value
Type | Description |
---|---|
SizeF |
Remarks
This property is used in the
Dock
Gets or sets which control borders are docked to its parent control and determines how a control is resized with its parent.
Declaration
public virtual DockStyle Dock { get; set; }
Property Value
Type | Description |
---|---|
DockStyle |
Remarks
Use the Dock property to define how a control is automatically resized as its parent control is
resized. For example, setting Dock to DockStyle.Left
causes the control to align itself with the
left edges of its parent control and to resize as the parent control is resized.
A control can be docked to one edge of its parent container or can be docked to all edges and fill the parent container.
GroupIndex
Gets or sets a group index.
Declaration
public int GroupIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Group index is used to group objects in the designer (using "Group" button). When you select any object in a group, entire group becomes selected. To reset a group, set the GroupIndex to 0 (default value).
Height
Gets or sets the height of the object.
Declaration
public virtual float Height { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property value is measured in the screen pixels. Use Units class to convert a value to desired units.
Examples
The following example demonstrates how to convert between pixels and units:
TextObject text1;
// set Height to 10mm
text1.Height = Units.Millimeters * 10;
// convert a value to millimeters
MessageBox.Show("Height = " + (text1.Height / Units.Millimeters).ToString() + "mm");
Left
Gets or sets the left coordinate of the object in relation to its container.
Declaration
public virtual float Left { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property value is measured in the screen pixels. Use Units class to convert a value to desired units.
To obtain absolute coordinate, use AbsLeft property.
Examples
The following example demonstrates how to convert between pixels and units:
TextObject text1;
// set Left to 10mm
text1.Left = Units.Millimeters * 10;
// convert a value to millimeters
MessageBox.Show("Left = " + (text1.Left / Units.Millimeters).ToString() + "mm");
Printable
Gets or sets a value that determines if the object can be printed on the printer.
Declaration
public bool Printable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Object with Printable = false is still visible in the preview window, but not on the printout. If you want to hide an object in the preview, set the Visible property to false.
PrintableExpression
Gets or sets a string containing expression that determines should be object printed on the printer.
Declaration
public string PrintableExpression { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Right
Gets the right coordinate of the object in relation to its container.
Declaration
public float Right { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
Tag
Gets or sets the Tag string for this component.
Declaration
public string Tag { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Top
Gets or sets the top coordinate of the object in relation to its container.
Declaration
public virtual float Top { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property value is measured in the screen pixels. Use Units class to convert a value to desired units.
To obtain absolute coordinate, use AbsTop property.
Examples
The following example demonstrates how to convert between pixels and units:
TextObject text1;
// set Top to 10mm
text1.Top = Units.Millimeters * 10;
// convert a value to millimeters
MessageBox.Show("Top = " + (text1.Top / Units.Millimeters).ToString() + "mm");
Visible
Gets or sets a value indicating whether the object is displayed in the preview window.
Declaration
public virtual bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Setting this property to false will hide the object in the preview window.
Examples
The following report script will control the Text1 visibility depending on the value of the data column:
private void Data1_BeforePrint(object sender, EventArgs e)
{
Text1.Visible = [Orders.Shipped] == true;
}
VisibleExpression
Gets or sets a string containing expression that determines should be object displayed in the preview window.
Declaration
public virtual string VisibleExpression { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Width
Gets or sets the width of the object.
Declaration
public virtual float Width { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property value is measured in the screen pixels. Use Units class to convert a value to desired units.
Examples
The following example demonstrates how to convert between pixels and units:
TextObject text1;
// set Width to 10mm
text1.Width = Units.Millimeters * 10;
// convert a value to millimeters
MessageBox.Show("Width = " + (text1.Width / Units.Millimeters).ToString() + "mm");
Methods
Assign(Base)
Declaration
public override void Assign(Base source)
Parameters
Type | Name | Description |
---|---|---|
Base | source |
Overrides
CalcVisibleExpression(String)
Caclulates visible expression value.
Declaration
public bool CalcVisibleExpression(string expression)
Parameters
Type | Name | Description |
---|---|---|
System.String | expression | The expression to calculate. |
Returns
Type | Description |
---|---|
System.Boolean | The result of calculation. |
GetExpressions()
Declaration
public override string[] GetExpressions()
Returns
Type | Description |
---|---|
System.String[] |
Overrides
Serialize(FRWriter)
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer |