Search Results for

    Show / Hide Table of Contents

    Class ComponentBase

    Class that implements some object's properties such as location, size and visibility.

    Inheritance
    System.Object
    Base
    ComponentBase
    DialogComponentBase
    PageBase
    ReportComponentBase
    TableColumn
    TableRow
    Implements
    IFRSerializable
    Inherited Members
    Base.Name
    Base.Restrictions
    Base.Flags
    Base.Parent
    Base.BaseName
    Base.ClassName
    Base.Report
    Base.Page
    Base.ChildObjects
    Base.AllObjects
    Base.ZOrder
    Base.IsAncestor
    Base.IsDesigning
    Base.IsPrinting
    Base.IsRunning
    Base.OriginalComponent
    Base.Disposed
    Base.SetProp(Base, Base)
    Base.FloatDiff(Single, Single)
    Base.DeserializeSubItems(FRReader)
    Base.ExtractDefaultMacros(String)
    Base.Dispose(Boolean)
    Base.Dispose()
    Base.SetFlags(Flags, Boolean)
    Base.SetReport(Report)
    Base.SetName(String)
    Base.SetParent(Base)
    Base.SetParentCore(Base)
    Base.FindObject(String)
    Base.CreateUniqueName()
    Base.Clear()
    Base.Deserialize(FRReader)
    Base.BaseAssign(Base)
    Base.AssignAll(Base)
    Base.HasParent(Base)
    Base.HasFlag(Flags)
    Base.HasRestriction(Restrictions)
    Base.InvokeEvent(String, Object)
    Base.OnAfterLoad()
    Base.GetCustomScript()
    Base.ExtractMacros()
    Base.IsHaveToConvert(Object)
    Base.GetConvertedObjects()
    Base.ForEachAllConvectedObjects(Object)
    Namespace: FastReport
    Assembly: FastReport.Base.dll
    Syntax
    public abstract class ComponentBase : Base, IDisposable, 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

    To change the bottom coordinate, change the Top and/or Height properties.

    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 class.

    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

    To change the right coordinate, change the Left and/or Width properties.

    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)

    Copies the contents of another, similar object.

    Declaration
    public override void Assign(Base source)
    Parameters
    Type Name Description
    Base source

    Source object to copy the contents from.

    Overrides
    Base.Assign(Base)
    Remarks

    Call Assign to copy the properties from another object of the same type. The standard form of a call to Assign is

    destination.Assign(source);

    which tells the destination object to copy the contents of the source object to itself. In this method, all child objects are ignored. If you want to copy child objects, use the AssignAll method.

    See Also
    AssignAll(Base)

    CalcVisibleExpression(String)

    Calculate 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()

    Gets all expressions contained in the object.

    Declaration
    public override string[] GetExpressions()
    Returns
    Type Description
    System.String[]

    Array of expressions or null if object contains no expressions.

    Overrides
    Base.GetExpressions()
    Remarks

    Do not call this method directly. You may override it if you are developing a new component for FastReport.

    This method is called by FastReport each time before run a report. FastReport do this to collect all expressions and compile them. For example, GetExpressions method of the TextObject class parses the text and returns all expressions found in the text.

    Serialize(FRWriter)

    Serializes the object.

    Declaration
    public override void Serialize(FRWriter writer)
    Parameters
    Type Name Description
    FRWriter writer

    Writer object.

    Overrides
    Base.Serialize(FRWriter)
    Remarks

    Do not call this method directly. You should override it if you are developing a new component for FastReport.

    This method is called when the object needs to save the state. It may happen when:

    • saving the report to the file or stream;
    • saving the report to the designer's undo buffer;
    • assigning the object to another object using the Assign(Base) or AssignAll methods;
    • saving the object to the designer's clipboard;
    • saving the object to the preview (when run a report).

    Implements

    IFRSerializable
    Back to top © 1998-2025 Copyright Fast Reports Inc.