Search Results for

    Show / Hide Table of Contents

    Class PreviewControl

    Represents a Windows Forms control used to preview a report.

    Inheritance
    System.Object
    System.MarshalByRefObject
    System.ComponentModel.Component
    System.Windows.Forms.Control
    System.Windows.Forms.ScrollableControl
    System.Windows.Forms.ContainerControl
    System.Windows.Forms.UserControl
    PreviewControl
    Namespace: FastReport.Preview
    Assembly: FastReport.dll
    Syntax
    [ToolboxBitmap(typeof(Report), "Resources.PreviewControl.bmp")]
    public class PreviewControl : UserControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl
    Remarks

    To use this control, place it on a form and link it to a report using the report's FastReport.Report.Preview property. To show a report, call the Report.Show method:

    report1.Preview = previewControl1;
    report1.Show();

    Use this control's methods such as Print(), Save() etc. to handle the preview. Call Clear() method to clear the preview.

    You can specify whether the standard toolbar is visible in the ToolbarVisible property. The StatusbarVisible property allows you to hide/show the statusbar.

    Constructors

    PreviewControl()

    Initializes a new instance of the PreviewControl class.

    Declaration
    public PreviewControl()

    Fields

    _controlHScrollBarHeight

    Declaration
    public int? _controlHScrollBarHeight
    Field Value
    Type Description
    System.Nullable<System.Int32>

    _controlVScrollBarWidth

    Declaration
    public int? _controlVScrollBarWidth
    Field Value
    Type Description
    System.Nullable<System.Int32>

    Properties

    ActivePageBorderColor

    Gets or sets the color of active page border.

    Declaration
    public Color ActivePageBorderColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    Buttons

    Specifies the set of buttons available in the toolbar.

    Declaration
    public PreviewButtons Buttons { get; set; }
    Property Value
    Type Description
    PreviewButtons

    Clouds

    Specifies the set of exports in clouds that will be available in the preview's "save" menu.

    Declaration
    public PreviewClouds Clouds { get; set; }
    Property Value
    Type Description
    PreviewClouds

    ControlHScrollBarHeight

    A static property for setting and getting the height of the horizontal scrollbar in the PreviewControl.

    Declaration
    public int? ControlHScrollBarHeight { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    ControlVScrollBarWidth

    A static property for setting and getting the width of the vertical scrollbar in the PreviewControl.

    Declaration
    public int? ControlVScrollBarWidth { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    Exports

    Specifies the set of exports that will be available in the preview's "save" menu.

    Declaration
    public PreviewExports Exports { get; set; }
    Property Value
    Type Description
    PreviewExports

    FastScrolling

    Gets or sets a value indicating whether the fast scrolling method should be used.

    Declaration
    public bool FastScrolling { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    If you enable this property, the gradient background will be disabled.

    OutlineExpand

    Gets or sets a value indicating whether the outline nodes are expanded or not.

    Declaration
    public bool OutlineExpand { get; set; }
    Property Value
    Type Description
    System.Boolean

    OutlineVisible

    Gets or sets a value indicating whether the outline control is visible.

    Declaration
    public bool OutlineVisible { get; set; }
    Property Value
    Type Description
    System.Boolean

    OutlineWidth

    Gets or sets a width of the prereview outline control.

    Declaration
    public int OutlineWidth { get; set; }
    Property Value
    Type Description
    System.Int32

    PageBorderColor

    Obsolete. Gets or sets the color of page border.

    Declaration
    [Browsable(false)]
    public Color PageBorderColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    PageCount

    Gets the pages count in the current report.

    Declaration
    [Browsable(false)]
    public int PageCount { get; }
    Property Value
    Type Description
    System.Int32

    PageNo

    Gets or sets the current page number.

    Declaration
    [Browsable(false)]
    public int PageNo { get; set; }
    Property Value
    Type Description
    System.Int32
    Remarks

    This value is 1-based.

    PageOffset

    Gets or sets the first page offset from the top left corner of the control.

    Declaration
    public Point PageOffset { get; set; }
    Property Value
    Type Description
    System.Drawing.Point

    Report

    Gets a reference to the report.

    Declaration
    [Browsable(false)]
    public Report Report { get; }
    Property Value
    Type Description
    Report

    SaveInitialDirectory

    Gets or sets the initial directory that is displayed by a save file dialog.

    Declaration
    public string SaveInitialDirectory { get; set; }
    Property Value
    Type Description
    System.String

    StatusBar

    Gets the preview window's statusbar.

    Declaration
    [Browsable(false)]
    public Bar StatusBar { get; }
    Property Value
    Type Description
    FastReport.DevComponents.DotNetBar.Bar

    StatusbarVisible

    Gets or sets a value indicating whether the statusbar is visible.

    Declaration
    public bool StatusbarVisible { get; set; }
    Property Value
    Type Description
    System.Boolean

    TabControl

    Gets a reference to the TabControl

    Declaration
    public TabControl TabControl { get; }
    Property Value
    Type Description
    FastReport.DevComponents.DotNetBar.TabControl

    ToolBar

    Gets the preview window's toolbar.

    Declaration
    [Browsable(false)]
    public Bar ToolBar { get; }
    Property Value
    Type Description
    FastReport.DevComponents.DotNetBar.Bar

    ToolbarVisible

    Gets or sets a value indicating whether the toolbar is visible.

    Declaration
    public bool ToolbarVisible { get; set; }
    Property Value
    Type Description
    System.Boolean

    UIStyle

    Gets or sets the visual style.

    Declaration
    public UIStyle UIStyle { get; set; }
    Property Value
    Type Description
    UIStyle

    UseBackColor

    Gets or sets a value indicating that the BackColor property must be used to draw the background area.

    Declaration
    public bool UseBackColor { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    By default, the background area is drawn using the color defined in the current UIStyle.

    Zoom

    Gets or sets the zoom factor.

    Declaration
    [Browsable(false)]
    public float Zoom { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    1 corresponds to 100% zoom.

    Methods

    AddTab(Report, String)

    Adds a new report tab to the preview control.

    Declaration
    public void AddTab(Report report, string text)
    Parameters
    Type Name Description
    Report report

    The Report object that contains the prepared report.

    System.String text

    The title for the new tab.

    Remarks

    Prepare the report using its Prepare method before you pass it to the report parameter.

    AddTab(Report, String, Boolean)

    Adds a new report tab to the preview control.

    Declaration
    public void AddTab(Report report, string text, bool setActive)
    Parameters
    Type Name Description
    Report report

    The Report object that contains the prepared report.

    System.String text

    The title for the new tab.

    System.Boolean setActive

    If true, makes the new tab active.

    Remarks

    Prepare the report using its Prepare method before you pass it to the report parameter.

    Clear()

    Clears the preview.

    Declaration
    public void Clear()

    CopyPage()

    Copies the current page in preview.

    Declaration
    public void CopyPage()

    DeletePage()

    Removes the current page in preview.

    Declaration
    public void DeletePage()

    DeleteTab(String)

    Deletes the report tab with specified text.

    Declaration
    public void DeleteTab(string text)
    Parameters
    Type Name Description
    System.String text

    The text of the tab.

    Design()

    Edits the current report in the designer.

    Declaration
    public void Design()

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    System.Windows.Forms.ContainerControl.Dispose(System.Boolean)

    EditPage()

    Edits the current page in the designer.

    Declaration
    public void EditPage()

    EditWatermark()

    Edits the watermark.

    Declaration
    public void EditWatermark()

    Find()

    Finds the text in the current report using the "Find Text" dialog.

    Declaration
    public void Find()

    Find(String, Boolean, Boolean)

    Finds the specified text in the current report.

    Declaration
    public bool Find(string text, bool matchCase, bool wholeWord)
    Parameters
    Type Name Description
    System.String text

    Text to find.

    System.Boolean matchCase

    A value indicating whether the search is case-sensitive.

    System.Boolean wholeWord

    A value indicating whether the search matches whole words only.

    Returns
    Type Description
    System.Boolean

    true if text found.

    FindNext()

    Finds the next occurence of text specified in the Find method.

    Declaration
    public bool FindNext()
    Returns
    Type Description
    System.Boolean

    true if text found.

    First()

    Navigates to the first page.

    Declaration
    public void First()

    Focus()

    Sets the focus to the preview control.

    Declaration
    public void Focus()

    HandleCloudForm()

    Opens Cloud form and shows selected prepared report.

    Declaration
    public void HandleCloudForm()

    Last()

    Navigates to the last page.

    Declaration
    public void Last()

    Load()

    Loads the report from a .fpx file using the "Open File" dialog.

    Declaration
    public void Load()

    Load(Stream)

    Load the report from a stream.

    Declaration
    public void Load(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream to load from.

    Load(String)

    Loads the report from a specified .fpx file.

    Declaration
    public void Load(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    Next()

    Navigates to the next page.

    Declaration
    public void Next()

    PageSetup()

    Edits the page settings.

    Declaration
    public void PageSetup()

    PositionTo(Int32, PointF)

    Navigates to the specified position inside a specified page.

    Declaration
    public void PositionTo(int pageNo, PointF point)
    Parameters
    Type Name Description
    System.Int32 pageNo

    The page number (1-based).

    System.Drawing.PointF point

    The position inside a page, in pixels.

    Print()

    Prints the current report.

    Declaration
    public bool Print()
    Returns
    Type Description
    System.Boolean

    true if report was printed; false if user cancels the "Print" dialog.

    Prior()

    Navigates to the previuos page.

    Declaration
    public void Prior()

    RefreshReport()

    Refresh the report.

    Declaration
    public void RefreshReport()

    Save()

    Saves the current report to a .fpx file using the "Save FIle" dialog.

    Declaration
    public void Save()

    Save(Stream)

    Saves the current report to a stream.

    Declaration
    public void Save(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    Save(String)

    Saves the current report to a specified .fpx file.

    Declaration
    public void Save(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    SendEmail()

    Sends an email.

    Declaration
    public void SendEmail()

    ShowStatus(String)

    Displays the text in the status bar.

    Declaration
    public void ShowStatus(string text)
    Parameters
    Type Name Description
    System.String text

    Text to display.

    SwitchToTab(String)

    Switches to the tab with specified text.

    Declaration
    public bool SwitchToTab(string text)
    Parameters
    Type Name Description
    System.String text

    Text of the tab.

    Returns
    Type Description
    System.Boolean

    true if the tab with specified text exists, or false if there is no such tab.

    TabExists(String)

    Checks if the tab with specified text exists.

    Declaration
    public bool TabExists(string text)
    Parameters
    Type Name Description
    System.String text

    The text of the tab.

    Returns
    Type Description
    System.Boolean

    true if the tab exists.

    UpdateDpiDependencies()

    Updates the control appearance and layout on dpi change.

    Declaration
    public void UpdateDpiDependencies()

    ZoomIn()

    Zooms in.

    Declaration
    public void ZoomIn()

    ZoomOut()

    Zooms out.

    Declaration
    public void ZoomOut()

    ZoomPageWidth()

    Zooms to fit the page width.

    Declaration
    public void ZoomPageWidth()

    ZoomWholePage()

    Zooms to fit the whole page.

    Declaration
    public void ZoomWholePage()

    Events

    OnExport

    Occurs when Export button clicked.

    Declaration
    public event EventHandler<PreviewControl.ExportEventArgs> OnExport
    Event Type
    Type Description
    System.EventHandler<PreviewControl.ExportEventArgs>

    OnPrint

    Occurs when Print button clicked.

    Declaration
    public event EventHandler<PreviewControl.PrintEventArgs> OnPrint
    Event Type
    Type Description
    System.EventHandler<PreviewControl.PrintEventArgs>

    PageChanged

    Occurs when current page number is changed.

    Declaration
    public event EventHandler PageChanged
    Event Type
    Type Description
    System.EventHandler

    Extension Methods

    UIUtils.DrawImageAndText(Control, DrawItemEventArgs, Image, String)
    UIUtils.DrawVisualStyleBorder(Control, Graphics, Rectangle)
    UIUtils.Dpi(Control)
    UIUtils.DpiMultiplier(Control)
    UIUtils.FontDpiMultiplier(Control)
    UIUtils.LogicalToDevice(Control, Int32)
    UIUtils.LogicalToDevice(Control, Single)
    UIUtils.LogicalToDevice(Control, Rectangle)
    UIUtils.LogicalToDevice(Control, Point)
    UIUtils.LogicalToDevice(Control, Size)
    UIUtils.LogicalToDevice(Control, Font, Boolean)
    UIUtils.GetImage(Control, Int32)
    UIUtils.GetImage(Control, String)
    UIUtils.GetImages(Control)
    Back to top © 1998-2025 Copyright Fast Reports Inc.