Class DesignerSettings
This class contains settings that will be applied to the report designer.
Inheritance
Namespace: FastReport.Design
Assembly: FastReport.dll
Syntax
[TypeConverter(typeof(FRExpandableObjectConverter))]
public class DesignerSettings
Constructors
DesignerSettings()
Initializes a new instance of the DesignerSettings class.
Declaration
public DesignerSettings()
Properties
ApplicationConnection
Gets or sets application-defined DbConnection object that will be used in the designer to create a new datasource.
Declaration
public DbConnection ApplicationConnection { get; set; }
Property Value
Type | Description |
---|---|
System.Data.Common.DbConnection |
Remarks
The application connection object is used in the "Data Wizard" to create new datasources. In this mode, you can't create any other connections in the wizard; only application connection is available. You still able to choose tables or create a new queries inside this connection. The connection information (ConnectionString) is not stored in the report file.
DefaultFont
Gets or sets the default font used in a report.
Declaration
public Font DefaultFont { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Font |
EmbeddedPreview
Gets or sets a value indicating whether the preview window is embedded into the designer form.
Declaration
public bool EmbeddedPreview { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Icon
Gets or sets the icon for the designer window.
Declaration
public Icon Icon { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Icon |
Restrictions
Gets the designer restrictions flags.
Declaration
public DesignerRestrictions Restrictions { get; set; }
Property Value
Type | Description |
---|---|
DesignerRestrictions |
ShowInTaskbar
Gets or sets a value indicating whether the designer window is displayed in the Windows taskbar.
Declaration
public bool ShowInTaskbar { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Text
Gets or sets the title text for the designer window.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
If no text is set, the default text "FastReport -" will be used.
ToolStripRenderer
Gets the toolstrip renderer.
Declaration
[Browsable(false)]
public ToolStripRenderer ToolStripRenderer { get; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.ToolStripRenderer |
Methods
AddCustomConnection(Type, String)
Adds a custom connection used in the "Data Wizard" window.
Declaration
public void AddCustomConnection(Type connectionType, string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.Type | connectionType | |
System.String | connectionString |
Remarks
Use this method to provide own connection strings for the "Data Wizard" dialog. To do this, you need to pass the type of connection object and connection string associated with it. You must use one of the connection objects registered in FastReport that inherit from the DataConnectionBase class.
To clear the custom connections, use the ClearCustomConnections() method.
Examples
This example shows how to add own connection string.
Config.DesignerSettings.AddCustomConnection(typeof(MsAccessDataConnection), @"Data Source=c:\data.mdb");
ClearCustomConnections()
Clears the custom connections added by the AddCustomConnection method.
Declaration
public void ClearCustomConnections()
Events
CustomOpenDialog
Declaration
public event OpenSaveDialogEventHandler CustomOpenDialog
Event Type
Type | Description |
---|---|
OpenSaveDialogEventHandler |
CustomOpenReport
Declaration
public event OpenSaveReportEventHandler CustomOpenReport
Event Type
Type | Description |
---|---|
OpenSaveReportEventHandler |
CustomPreviewReport
Occurs when previewing a report from the designer.
Declaration
public event EventHandler CustomPreviewReport
Event Type
Type | Description |
---|---|
System.EventHandler |
Remarks
Use this event to show own preview window.
Examples
Config.DesignerSettings.CustomPreviewReport += new EventHandler(MyPreviewHandler);
private void MyPreviewHandler(object sender, EventArgs e)
{
Report report = sender as Report;
using (MyPreviewForm form = new MyPreviewForm())
{
report.Preview = form.previewControl1;
report.ShowPreparedReport();
form.ShowDialog();
}
}
CustomQueryBuilder
Occurs when the query builder is called.
Declaration
public event CustomQueryBuilderEventHandler CustomQueryBuilder
Event Type
Type | Description |
---|---|
CustomQueryBuilderEventHandler |
Remarks
Subscribe to this event if you want to replace the embedded query builder with your own one.
CustomSaveDialog
Declaration
public event OpenSaveDialogEventHandler CustomSaveDialog
Event Type
Type | Description |
---|---|
OpenSaveDialogEventHandler |
CustomSaveReport
Declaration
public event OpenSaveReportEventHandler CustomSaveReport
Event Type
Type | Description |
---|---|
OpenSaveReportEventHandler |
DesignerClosed
Occurs when the designer is closed.
Declaration
public event EventHandler DesignerClosed
Event Type
Type | Description |
---|---|
System.EventHandler |
DesignerLoaded
Occurs when the designer is loaded.
Declaration
public event EventHandler DesignerLoaded
Event Type
Type | Description |
---|---|
System.EventHandler |
Remarks
Use this event if you want to customize some aspects of the designer, for example, to hide some menu items.
Examples
This example demonstrates how to hide the "File|Select Language..." menu item.
Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
{
(sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
}
FilterConnectionTables
Occurs when getting available table names from the connection.
Declaration
public event FilterConnectionTablesEventHandler FilterConnectionTables
Event Type
Type | Description |
---|---|
FilterConnectionTablesEventHandler |
Remarks
Use this handler to filter the list of tables returned by the connection object.
Examples
This example demonstrates how to hide the table with "Table 1" name from the Data Wizard.
Config.DesignerSettings.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
{
if (e.TableName == "Table 1")
e.Skip = true;
}
ObjectInserted
Occurs when object is inserted.
Declaration
public event ObjectInsertedEventHandler ObjectInserted
Event Type
Type | Description |
---|---|
ObjectInsertedEventHandler |
PageAdded
Occurs when a report page or a dialog form is added to the report.
Declaration
public event EventHandler PageAdded
Event Type
Type | Description |
---|---|
System.EventHandler |
Remarks
Use this event if you want to customize the page properties.
Examples
This example demonstrates how to change the default page margins.
Config.DesignerSettings.PageAdded += new EventHandler(DesignerSettings_PageAdded);
void DesignerSettings_PageAdded(object sender, EventArgs e)
{
if (sender is ReportPage)
(sender as ReportPage).TopMargin = 0;
}
ReportLoaded
Occurs when the report is loaded.
Declaration
public event ReportLoadedEventHandler ReportLoaded
Event Type
Type | Description |
---|---|
ReportLoadedEventHandler |