ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Viewer.Win Assembly / GrapeCity.ActiveReports.Viewer.Win Namespace / Viewer Class / Viewer Constructor
Example

Viewer Constructor
Initializes a new instance of Viewer class.
Syntax
'Declaration
 
Public Function New()
 
Remarks
This constructor initializes the viewer with default settings, prepares the UI components, and sets up the necessary model-view bindings. It also handles license validation, initializes the model and view model, and configures the report panes. Additionally, it sets up context menus for mouse and touch modes, binds toolbar actions, and listens for various events to update the UI accordingly.

In design mode, it switches to touch mode directly. Otherwise, it proceeds to configure the sidebar, error panel, wait notification view, and other UI elements based on the viewer model's state. It also listens for document loading, search results, hyperlink actions, zoom changes, and sidebar pane changes to trigger the appropriate UI updates or actions.

The constructor also reads the print dialog style from the configuration and sets the printing settings accordingly. Finally, it switches the UI theme and touch mode based on the viewer model's settings.

Example
// Create a new instance of the Viewer control and add it to the form.
Viewer reportViewer = new Viewer();
reportViewer.Dock = DockStyle.Fill;
this.Controls.Add(reportViewer);
// Load a report into the Viewer.
reportViewer.LoadDocument("path/to/your/report.rdlx");
See Also