Class ReportComponentBase
Base class for all report objects.
Inheritance
Implements
Inherited Members
Namespace: FastReport
Assembly: FastReport.OpenSource.dll
Syntax
public abstract class ReportComponentBase : ComponentBase, IFRSerializable
Constructors
ReportComponentBase()
Initializes a new instance of the ReportComponentBase class with default settings.
Declaration
public ReportComponentBase()
Properties
AfterDataEvent
Gets or sets a script event name that will be fired after the object was filled with data.
Declaration
public string AfterDataEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
AfterPrintEvent
Gets or sets a script event name that will be fired after the object was printed in the preview page.
Declaration
public string AfterPrintEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
BeforePrintEvent
Gets or sets a script event name that will be fired before the object will be printed in the preview page.
Declaration
public string BeforePrintEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Bookmark
Gets or sets a bookmark expression.
Declaration
public string Bookmark { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property can contain any valid expression that returns a bookmark name. This can be, for example, a data column. To navigate to a bookmark, you have to use the Hyperlink property.
Border
Gets or sets an object's border.
Declaration
public virtual Border Border { get; set; }
Property Value
Type | Description |
---|---|
Border |
CanGrow
Determines if the object can grow.
Declaration
public bool CanGrow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This property is applicable to the bands or text objects that can contain several text lines. If the property is set to true, object will grow to display all the information that it contains.
CanShrink
Determines if the object can shrink.
Declaration
public bool CanShrink { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This property is applicable to the bands or text objects that can contain several text lines. If the property is set to true, object can shrink to remove the unused space.
ClickEvent
Gets or sets a script event name that will be fired when the user click the object in the preview window.
Declaration
public string ClickEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Cursor
Gets or sets an object's cursor shape.
Declaration
public Cursor Cursor { get; set; }
Property Value
Type | Description |
---|---|
Cursor |
Remarks
This property is used in the preview mode.
EvenStyle
Gets or sets a style name that will be applied to even band rows.
Declaration
public string EvenStyle { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Style with this name must exist in the Styles collection.
EvenStylePriority
Gets or sets a value that determines which properties of the even style to use.
Declaration
public StylePriority EvenStylePriority { get; set; }
Property Value
Type | Description |
---|---|
StylePriority |
Remarks
Usually you will need only the Fill property of the even style to be applied. If you want to apply all style settings, set this property to StylePriority.UseAll.
Exportable
Gets or sets a value that determines if the object can be exported.
Declaration
public bool Exportable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Fill
Gets or sets an object's fill.
Declaration
public virtual FillBase Fill { get; set; }
Property Value
Type | Description |
---|---|
FillBase |
Remarks
The fill can be one of the following types: SolidFill, LinearGradientFill, PathGradientFill, HatchFill.
To set the solid fill color, use the simpler FillColor property.
Examples
This example shows how to set the new fill and change its properties:
textObject1.Fill = new SolidFill(Color.Green);
(textObject1.Fill as SolidFill).Color = Color.Red;
FillColor
Gets or sets the fill color in a simple manner.
Declaration
public Color FillColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
Remarks
This property can be used in a report script to change the fill color of the object. It is equivalent to:
reportComponent1.Fill = new SolidFill(color);
FlagPreviewVisible
Gets or sets a value indicates that object should not be added to the preview.
Declaration
public bool FlagPreviewVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
FlagProvidesHyperlinkValue
Determines if an object can provide the hyperlink value automatically.
Declaration
public bool FlagProvidesHyperlinkValue { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This flag is used in complex objects such as Matrix or Chart. These objects can provide a hyperlink value automatically, depending on where you click.
FlagSerializeStyle
Determines if serializing the Style property is needed.
Declaration
public bool FlagSerializeStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The Style property must be serialized last. Some ancestor classes may turn off the standard Style serialization and serialize it by themselves.
FlagSimpleBorder
Determines if the object has custom border and use only Border.Width, Border.Style and Border.Color properties.
Declaration
public bool FlagSimpleBorder { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This flag is used to disable some toolbar buttons when such object is selected. Applicable to the ShapeObject and LineObject.
FlagUseBorder
Determines if the object uses the Border.
Declaration
public bool FlagUseBorder { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This flag is used to disable some toolbar buttons when such object is selected.
FlagUseFill
Determines if the object uses the fill.
Declaration
public bool FlagUseFill { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This flag is used to disable some toolbar buttons when such object is selected.
GrowToBottom
Determines if the object must grow to the band's bottom side.
Declaration
public bool GrowToBottom { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
If the property is set to true, object grows to the bottom side of its parent. This is useful if you have several objects on a band, and some of them can grow or shrink.
HoverStyle
Gets or sets a style name that will be applied to this object when the mouse pointer is over it.
Declaration
public string HoverStyle { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Style with this name must exist in the Styles collection.
Hyperlink
Gets or sets a hyperlink.
Declaration
public Hyperlink Hyperlink { get; }
Property Value
Type | Description |
---|---|
Hyperlink |
Remarks
The hyperlink is used to define clickable objects in the preview. When you click such object, you may navigate to the external url, the page number, the bookmark defined by other report object, or display the external report. Set the Kind property of the hyperlink to select appropriate behavior.
Usually you should set the Expression property of the hyperlink to any valid expression that will be calculated when this object is about to print. The value of an expression will be used for navigation.
If you want to navigate to something fixed (URL or page number, for example) you also may set the Value property instead of Expression.
MouseDownEvent
Gets or sets a script event name that will be fired when the user clicks the mouse button in the preview window.
Declaration
public string MouseDownEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MouseEnterEvent
Gets or sets a script event name that will be fired when the mouse enters the object's bounds in the preview window.
Declaration
public string MouseEnterEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MouseLeaveEvent
Gets or sets a script event name that will be fired when the mouse leaves the object's bounds in the preview window.
Declaration
public string MouseLeaveEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MouseMoveEvent
Gets or sets a script event name that will be fired when the user moves the mouse over the object in the preview window.
Declaration
public string MouseMoveEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MouseUpEvent
Gets or sets a script event name that will be fired when the user releases the mouse button in the preview window.
Declaration
public string MouseUpEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PrintOn
Gets or sets a value that determines where to print the object.
Declaration
public PrintOn PrintOn { get; set; }
Property Value
Type | Description |
---|---|
PrintOn |
Remarks
See the PrintOn enumeration for details.
ShiftMode
Gets or sets a shift mode of the object.
Declaration
public ShiftMode ShiftMode { get; set; }
Property Value
Type | Description |
---|---|
ShiftMode |
Remarks
See ShiftMode enumeration for details.
Style
Gets or sets the style name.
Declaration
public string Style { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Style is a set of common properties such as border, fill, font, text color. The Report has a set of styles in the Styles property.
Methods
ApplyStyle(Style)
Applies the style settings.
Declaration
public virtual void ApplyStyle(Style style)
Parameters
Type | Name | Description |
---|---|---|
Style | style | Style to apply. |
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
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(Base) method.
See Also
CalcHeight()
Calculates the object's height.
Declaration
public virtual float CalcHeight()
Returns
Type | Description |
---|---|
System.Single | Actual object's height, in pixels. |
Remarks
Applicable to objects that contain several text lines, such as TextObject. Returns the height needed to display all the text lines.
Deserialize(FRReader)
Declaration
public override void Deserialize(FRReader reader)
Parameters
Type | Name | Description |
---|---|---|
FRReader | reader |
Overrides
Draw(FRPaintEventArgs)
Declaration
public override void Draw(FRPaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
FRPaintEventArgs | e |
DrawBackground(FRPaintEventArgs)
Draws the object's background.
Declaration
public void DrawBackground(FRPaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
FRPaintEventArgs | e | Draw event arguments. |
FinalizeComponent()
Performs a finalization after the report is finished.
Declaration
public virtual void FinalizeComponent()
Remarks
This method is used by the report engine, do not call it directly.
GetData()
Gets the data from a datasource that the object is connected to.
Declaration
public virtual void GetData()
Remarks
This method is called by the report engine before processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should get the data from a datasource that the object is connected to.
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
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.
HasClickListeners()
Checks if there are any listeners to the Click event.
Declaration
public bool HasClickListeners()
Returns
Type | Description |
---|---|
System.Boolean |
InitializeComponent()
Initializes the object before running a report.
Declaration
public virtual void InitializeComponent()
Remarks
This method is used by the report engine, do not call it directly.
IsVisible(FRPaintEventArgs)
Determines if the object is visible on current drawing surface.
Declaration
public virtual bool IsVisible(FRPaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
FRPaintEventArgs | e | Draw event arguments. |
Returns
Type | Description |
---|---|
System.Boolean |
OnAfterData(EventArgs)
This method fires the AfterData event and the script code connected to the AfterDataEvent.
Declaration
public virtual void OnAfterData(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnAfterLoad()
Called after all report objects were loaded.
Declaration
public override void OnAfterLoad()
Overrides
Remarks
Do not call this method directly. You may override it if you are developing a new component for FastReport.
OnAfterPrint(EventArgs)
This method fires the AfterPrint event and the script code connected to the AfterPrintEvent.
Declaration
public virtual void OnAfterPrint(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnBeforePrint(EventArgs)
This method fires the BeforePrint event and the script code connected to the BeforePrintEvent.
Declaration
public virtual void OnBeforePrint(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnClick(EventArgs)
This method fires the Click event and the script code connected to the ClickEvent.
Declaration
public virtual void OnClick(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
RestoreState()
Restores the object's state after printing it.
Declaration
public virtual void RestoreState()
Remarks
This method is called by the report engine after processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should restore the object properties that were saved by the SaveState() method.
RestoreStyle()
Restores the current style.
Declaration
public virtual void RestoreStyle()
SaveState()
Saves the object's state before printing it.
Declaration
public virtual void SaveState()
Remarks
This method is called by the report engine before processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should save any object properties that may be changed during the object printing. The standard implementation saves the object's bounds, visibility, bookmark and hyperlink.
SaveStyle()
Saves the current style.
Declaration
public virtual void SaveStyle()
Serialize(FRWriter)
Serializes the object.
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer | Writer object. |
Overrides
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(Base) methods;
- saving the object to the designer's clipboard;
- saving the object to the preview (when run a report).
Events
AfterData
This event occurs after the object was filled with data.
Declaration
public event EventHandler AfterData
Event Type
Type | Description |
---|---|
System.EventHandler |
AfterPrint
This event occurs after the object was added to the preview pages.
Declaration
public event EventHandler AfterPrint
Event Type
Type | Description |
---|---|
System.EventHandler |
BeforePrint
This event occurs before the object is added to the preview pages.
Declaration
public event EventHandler BeforePrint
Event Type
Type | Description |
---|---|
System.EventHandler |
Click
This event occurs when the user clicks the object in the preview window.
Declaration
public event EventHandler Click
Event Type
Type | Description |
---|---|
System.EventHandler |