Class Designer
Represents the report's designer control.
Inheritance
Namespace: FastReport.Design
Assembly: FastReport.dll
Syntax
public class Designer : UserControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, ISupportInitialize
Remarks
Usually you don't need to create an instance of this class. The designer can be called using the FastReport.Report.Design method of the Report instance.
This control represents pure designer surface + Objects toolbar. If you need standard menu, statusbar, toolbars and tool windows, use the DesignerControl control instead. Also you may decide to use a designer's form (DesignerForm) instead of a control.
To run a designer, you need to attach a Report instance to it. This can be done via the Report property.
To call the designer in MDI (Multi-Document Interface) mode, use the MdiMode property.
To set up some global properties, use the Config static class or EnvironmentSettings component that you can use in the Visual Studio IDE.
Constructors
Designer()
Initializes a new instance of the Designer class with default settings.
Declaration
public Designer()
Properties
ActiveReport
Gets active report object.
Declaration
[Browsable(false)]
public Report ActiveReport { get; set; }
Property Value
| Type | Description |
|---|---|
| Report |
Remarks
May be null if Start Page selected, or no reports opened.
AskSave
Gets or sets a value that determines whether to ask user to save changes when closing the designer.
Declaration
public bool AskSave { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
cmdAbout
The "Help|About..." command.
Declaration
[Browsable(false)]
public AboutCommand cmdAbout { get; }
Property Value
| Type | Description |
|---|---|
| AboutCommand |
cmdAccount
The "Help|Account" command.
Declaration
[Browsable(false)]
public AccountCommand cmdAccount { get; }
Property Value
| Type | Description |
|---|---|
| AccountCommand |
cmdAddData
The "Data|Add New Data Source..." command.
Declaration
[Browsable(false)]
public AddDataCommand cmdAddData { get; }
Property Value
| Type | Description |
|---|---|
| AddDataCommand |
cmdBringToFront
The "Bring To Front" command.
Declaration
[Browsable(false)]
public BringToFrontCommand cmdBringToFront { get; }
Property Value
| Type | Description |
|---|---|
| BringToFrontCommand |
cmdChooseData
The "Data|Choose Report Data..." command.
Declaration
[Browsable(false)]
public ChooseDataCommand cmdChooseData { get; }
Property Value
| Type | Description |
|---|---|
| ChooseDataCommand |
cmdClose
The "File|Close" command.
Declaration
[Browsable(false)]
public CloseCommand cmdClose { get; }
Property Value
| Type | Description |
|---|---|
| CloseCommand |
cmdCloseAll
The "Window|Close All" command.
Declaration
[Browsable(false)]
public CloseAllCommand cmdCloseAll { get; }
Property Value
| Type | Description |
|---|---|
| CloseAllCommand |
cmdCopy
The "Edit|Copy" command.
Declaration
[Browsable(false)]
public CopyCommand cmdCopy { get; }
Property Value
| Type | Description |
|---|---|
| CopyCommand |
cmdCopyPage
The "Edit|Copy Page" command.
Declaration
[Browsable(false)]
public CopyPageCommand cmdCopyPage { get; }
Property Value
| Type | Description |
|---|---|
| CopyPageCommand |
cmdCut
The "Edit|Cut" command.
Declaration
[Browsable(false)]
public CutCommand cmdCut { get; }
Property Value
| Type | Description |
|---|---|
| CutCommand |
cmdDelete
The "Edit|Delete" command.
Declaration
[Browsable(false)]
public DeleteCommand cmdDelete { get; }
Property Value
| Type | Description |
|---|---|
| DeleteCommand |
cmdDeletePage
The "Edit|Delete Page" command.
Declaration
[Browsable(false)]
public DeletePageCommand cmdDeletePage { get; }
Property Value
| Type | Description |
|---|---|
| DeletePageCommand |
cmdEdit
The "Edit" command.
Declaration
[Browsable(false)]
public EditCommand cmdEdit { get; }
Property Value
| Type | Description |
|---|---|
| EditCommand |
cmdFind
The "Edit|Find..." command.
Declaration
[Browsable(false)]
public FindCommand cmdFind { get; }
Property Value
| Type | Description |
|---|---|
| FindCommand |
cmdFormatPainter
The "Format Painter" toolbar command.
Declaration
[Browsable(false)]
public FormatPainterCommand cmdFormatPainter { get; }
Property Value
| Type | Description |
|---|---|
| FormatPainterCommand |
cmdGroup
The "Edit|Group" command.
Declaration
[Browsable(false)]
public GroupCommand cmdGroup { get; }
Property Value
| Type | Description |
|---|---|
| GroupCommand |
cmdHelpContents
The "Help|Help Contents..." command.
Declaration
[Browsable(false)]
public HelpContentsCommand cmdHelpContents { get; }
Property Value
| Type | Description |
|---|---|
| HelpContentsCommand |
cmdInsert
The "Insert" command.
Declaration
[Browsable(false)]
public InsertCommand cmdInsert { get; }
Property Value
| Type | Description |
|---|---|
| InsertCommand |
cmdInsertBand
The "Insert Band" command.
Declaration
[Browsable(false)]
public InsertBandCommand cmdInsertBand { get; }
Property Value
| Type | Description |
|---|---|
| InsertBandCommand |
cmdNew
The "File|New" command.
Declaration
[Browsable(false)]
public NewCommand cmdNew { get; }
Property Value
| Type | Description |
|---|---|
| NewCommand |
cmdNewDialog
The "New Dialog" toolbar command.
Declaration
[Browsable(false)]
public NewDialogCommand cmdNewDialog { get; }
Property Value
| Type | Description |
|---|---|
| NewDialogCommand |
cmdNewPage
The "New Page" toolbar command.
Declaration
[Browsable(false)]
public NewPageCommand cmdNewPage { get; }
Property Value
| Type | Description |
|---|---|
| NewPageCommand |
cmdOpen
The "File|Open|Open locally." command.
Declaration
[Browsable(false)]
public OpenCommand cmdOpen { get; }
Property Value
| Type | Description |
|---|---|
| OpenCommand |
cmdOpenPage
The "File|Open|Open page." command.
Declaration
[Browsable(false)]
public OpenPageCommand cmdOpenPage { get; }
Property Value
| Type | Description |
|---|---|
| OpenPageCommand |
cmdOpenViaCloud
The "File|Open|Open via Cloud." command.
Declaration
[Browsable(false)]
public OpenViaCloudCommand cmdOpenViaCloud { get; }
Property Value
| Type | Description |
|---|---|
| OpenViaCloudCommand |
cmdOptions
The "View|Options..." command.
Declaration
[Browsable(false)]
public OptionsCommand cmdOptions { get; }
Property Value
| Type | Description |
|---|---|
| OptionsCommand |
cmdPageSetup
The "File|Page Setup..." command.
Declaration
[Browsable(false)]
public PageSettingsCommand cmdPageSetup { get; }
Property Value
| Type | Description |
|---|---|
| PageSettingsCommand |
cmdPaste
The "Edit|Paste" command.
Declaration
[Browsable(false)]
public PasteCommand cmdPaste { get; }
Property Value
| Type | Description |
|---|---|
| PasteCommand |
CmdPolySelectAddPoint
The "Polygon add new point" command.
Declaration
[Browsable(false)]
public PolygonSelectModeCommand CmdPolySelectAddPoint { get; }
Property Value
| Type | Description |
|---|---|
| PolygonSelectModeCommand |
CmdPolySelectBezier
The "Polygon berier" command.
Declaration
[Browsable(false)]
public PolygonSelectModeCommand CmdPolySelectBezier { get; }
Property Value
| Type | Description |
|---|---|
| PolygonSelectModeCommand |
CmdPolySelectMove
The "Polygon move command" command.
Declaration
[Browsable(false)]
public PolygonSelectModeCommand CmdPolySelectMove { get; }
Property Value
| Type | Description |
|---|---|
| PolygonSelectModeCommand |
CmdPolySelectPointer
The "Polygon point move" command.
Declaration
[Browsable(false)]
public PolygonSelectModeCommand CmdPolySelectPointer { get; }
Property Value
| Type | Description |
|---|---|
| PolygonSelectModeCommand |
CmdPolySelectRemovePoint
The "Polygon remove point" command.
Declaration
[Browsable(false)]
public PolygonSelectModeCommand CmdPolySelectRemovePoint { get; }
Property Value
| Type | Description |
|---|---|
| PolygonSelectModeCommand |
cmdPreview
The "File|Preview..." command.
Declaration
[Browsable(false)]
public PreviewCommand cmdPreview { get; }
Property Value
| Type | Description |
|---|---|
| PreviewCommand |
cmdPreviewCloud
The "File|Preview on Cloud..." command.
Declaration
[Browsable(false)]
public PreviewCloudCommand cmdPreviewCloud { get; }
Property Value
| Type | Description |
|---|---|
| PreviewCloudCommand |
cmdPrinterSetup
The "File|Printer Setup..." command.
Declaration
[Browsable(false)]
public PrinterSettingsCommand cmdPrinterSetup { get; }
Property Value
| Type | Description |
|---|---|
| PrinterSettingsCommand |
cmdRecentFiles
The "Recent Files" command.
Declaration
[Browsable(false)]
public RecentFilesCommand cmdRecentFiles { get; }
Property Value
| Type | Description |
|---|---|
| RecentFilesCommand |
cmdRedo
The "Edit|Redo" command.
Declaration
[Browsable(false)]
public RedoCommand cmdRedo { get; }
Property Value
| Type | Description |
|---|---|
| RedoCommand |
cmdReplace
The "Edit|Replace..." command.
Declaration
[Browsable(false)]
public ReplaceCommand cmdReplace { get; }
Property Value
| Type | Description |
|---|---|
| ReplaceCommand |
cmdReportSettings
The "Report|Options..." command.
Declaration
[Browsable(false)]
public ReportSettingsCommand cmdReportSettings { get; }
Property Value
| Type | Description |
|---|---|
| ReportSettingsCommand |
cmdReportStyles
The "Report|Styles..." command.
Declaration
[Browsable(false)]
public ReportStylesCommand cmdReportStyles { get; }
Property Value
| Type | Description |
|---|---|
| ReportStylesCommand |
cmdReportValidation
The "Report|Validation" command.
Declaration
[Browsable(false)]
public ReportValidationCommand cmdReportValidation { get; }
Property Value
| Type | Description |
|---|---|
| ReportValidationCommand |
cmdSave
The "File|Save" command.
Declaration
[Browsable(false)]
public SaveCommand cmdSave { get; }
Property Value
| Type | Description |
|---|---|
| SaveCommand |
cmdSaveAll
The "File|Save All" command.
Declaration
[Browsable(false)]
public SaveAllCommand cmdSaveAll { get; }
Property Value
| Type | Description |
|---|---|
| SaveAllCommand |
cmdSaveAs
The "File|Save As..." command.
Declaration
[Browsable(false)]
public SaveAsCommand cmdSaveAs { get; }
Property Value
| Type | Description |
|---|---|
| SaveAsCommand |
cmdSaveToCloudCommand
The "File|Save to Cloud" command.
Declaration
[Browsable(false)]
public SaveToCloudCommand cmdSaveToCloudCommand { get; }
Property Value
| Type | Description |
|---|---|
| SaveToCloudCommand |
cmdSaveWithRandomData
The "File|Save With Random Data..." command.
Declaration
[Browsable(false)]
public SaveWithRandomDataCommand cmdSaveWithRandomData { get; }
Property Value
| Type | Description |
|---|---|
| SaveWithRandomDataCommand |
cmdSelectAll
The "Edit|Select All" command.
Declaration
[Browsable(false)]
public SelectAllCommand cmdSelectAll { get; }
Property Value
| Type | Description |
|---|---|
| SelectAllCommand |
cmdSelectLanguage
The "File|Select Language..." command.
Declaration
[Browsable(false)]
public SelectLanguageCommand cmdSelectLanguage { get; }
Property Value
| Type | Description |
|---|---|
| SelectLanguageCommand |
cmdSendToBack
The "Send To Back" command.
Declaration
[Browsable(false)]
public SendToBackCommand cmdSendToBack { get; }
Property Value
| Type | Description |
|---|---|
| SendToBackCommand |
cmdSortDataSources
The "Data|Sort Data Sources" command.
Declaration
public SortDataSourcesCommand cmdSortDataSources { get; }
Property Value
| Type | Description |
|---|---|
| SortDataSourcesCommand |
cmdUndo
The "Edit|Undo" command.
Declaration
[Browsable(false)]
public UndoCommand cmdUndo { get; }
Property Value
| Type | Description |
|---|---|
| UndoCommand |
cmdUngroup
The "Edit|Ungroup" command.
Declaration
[Browsable(false)]
public UngroupCommand cmdUngroup { get; }
Property Value
| Type | Description |
|---|---|
| UngroupCommand |
cmdViewStartPage
The "View|Start Page" command.
Declaration
[Browsable(false)]
public ViewStartPageCommand cmdViewStartPage { get; }
Property Value
| Type | Description |
|---|---|
| ViewStartPageCommand |
cmdWelcome
The "Show welcome window..." command.
Declaration
[Browsable(false)]
public WelcomeCommand cmdWelcome { get; }
Property Value
| Type | Description |
|---|---|
| WelcomeCommand |
DockLayoutKey
Gets or sets key name to store docking layout.
Declaration
public string DockLayoutKey { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
IsPreviewPageDesigner
Gets a value indicating that designer is used to edit a preview page.
Declaration
[Browsable(false)]
public bool IsPreviewPageDesigner { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LayoutState
Gets or sets the layout state of the designer.
Declaration
[Browsable(false)]
public string LayoutState { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
This property is used to store layout in Visual Studio design time. You may also use it to save and restore the designer's layout in your code. However, consider using the SaveConfig() and RestoreConfig() methods that use FastReport configuration file.
MdiMode
Gets or sets a value indicating that designer is run in MDI mode.
Declaration
public bool MdiMode { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
To call the designer in MDI (Multi-Document Interface) mode, use the following code:
DesignerControl designer = new DesignerControl();
designer.MdiMode = true;
designer.ShowDialog();
Modified
Gets or sets a value indicating that the report was modified.
Declaration
[Browsable(false)]
public bool Modified { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Objects
Gets a collection of objects on the active page of the active report.
Declaration
[Browsable(false)]
public ObjectCollection Objects { get; }
Property Value
| Type | Description |
|---|---|
| ObjectCollection |
Plugins
Gets a collection of global plugins such as menu, properties window, etc.
Declaration
[Browsable(false)]
public PluginCollection Plugins { get; }
Property Value
| Type | Description |
|---|---|
| PluginCollection |
Report
Gets or sets the edited report.
Declaration
[Browsable(false)]
public Report Report { get; set; }
Property Value
| Type | Description |
|---|---|
| Report |
Remarks
To initialize the designer, you need to pass a Report instance to this property. This will create the designer's surface associated with the report.
Designer designer = new Designer();
designer.Parent = form1;
designer.Report = report1;
Restrictions
Gets the designer restrictions.
Declaration
public DesignerRestrictions Restrictions { get; }
Property Value
| Type | Description |
|---|---|
| DesignerRestrictions |
SelectedComponents
Gets a collection of selected objects of the ComponentBase type.
Declaration
[Browsable(false)]
public SelectedComponents SelectedComponents { get; }
Property Value
| Type | Description |
|---|---|
| SelectedComponents |
SelectedObjects
Gets a collection of selected objects on the active page of the active report.
Declaration
[Browsable(false)]
public SelectedObjectCollection SelectedObjects { get; }
Property Value
| Type | Description |
|---|---|
| SelectedObjectCollection |
SelectedReportComponents
Gets a collection of selected objects of the ReportComponentBase type.
Declaration
[Browsable(false)]
public SelectedReportComponents SelectedReportComponents { get; }
Property Value
| Type | Description |
|---|---|
| SelectedReportComponents |
SelectedTextObjects
Gets a collection of selected objects of the TextObject type.
Declaration
[Browsable(false)]
public SelectedTextObjects SelectedTextObjects { get; }
Property Value
| Type | Description |
|---|---|
| SelectedTextObjects |
UIStyle
Gets or sets the visual style.
Declaration
public UIStyle UIStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| UIStyle |
Zoom
Gets or sets the zoom factor.
Declaration
public float Zoom { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
ZoomDpi
Gets the zoom factor with respect of designer's dpi value.
Declaration
public float ZoomDpi { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
BeginInit()
Declaration
public void BeginInit()
CancelPaste()
Cancels paste mode.
Declaration
public void CancelPaste()
ClearMessages()
Clears the "Messages" window.
Declaration
public void ClearMessages()
CloseAll()
Close all opened reports, ask to save changes.
Declaration
public bool CloseAll()
Returns
| Type | Description |
|---|---|
| System.Boolean | true if all tabs closed succesfully. |
Remarks
Use this method to close all opened documents and save changes when you closing the main form that contains the designer control. To do this, create an event handler for your form's FormClosing event and call this method inside the handler. If it returns false, set e.Cancel to true.
CreateEmptyReport()
Tries to create a new empty report.
Declaration
public bool CreateEmptyReport()
Returns
| Type | Description |
|---|---|
| System.Boolean | true if report was created successfully; false if user cancels the action. |
EndInit()
Declaration
public void EndInit()
InitPlugins()
Initializes designer plugins such as toolbars and toolwindows.
Declaration
protected virtual void InitPlugins()
InitReport()
Initializes the workspace after the new report is loaded.
Declaration
public void InitReport()
Localize()
Updates localization of the designer.
Declaration
public void Localize()
Lock()
Locks all plugins.
Declaration
public void Lock()
Remarks
This method is usually called when we destroy the report to prevent unexpected errors - such as trying to draw destroyed objects.
OnParentChanged(EventArgs)
Declaration
protected override void OnParentChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
Overrides
ParentFormClosing(FormClosingEventArgs)
Checks if parent window can be closed.
Declaration
public void ParentFormClosing(FormClosingEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.FormClosingEventArgs | e | The cancel event args. |
Remarks
Use this method in the window's FormClosing event handler if you use this control. This method checks if the embedded preview is running and cancels it. Also if there is unsaved changes, the user will be asked to save changes.
RefreshLayout()
Refresh the designer's toolbars and toolwindows layout.
Declaration
public void RefreshLayout()
Remarks
Call this method if you use DesignerControl. To restore the layout that you've created in VS design time, you need to call this method in the form's Load event handler. If you don't do this, tool windows like Properties, Data, Report Tree will not be available.
RestoreConfig()
Restores config from a FastReport configuration file.
Declaration
public void RestoreConfig()
Remarks
Call this method to restore the designer's layout. You need to do this after the designer's control is placed on a form.
SaveConfig()
Saves config to a FastReport configuration file.
Declaration
public void SaveConfig()
SelectionChanged(Object)
Call this method to tell the designer that current selection is changed.
Declaration
public void SelectionChanged(object sender)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The plugin that changes the selection (may be null). |
SetModified()
Call this method if you change something in the report.
Declaration
public void SetModified()
Remarks
This method adds the current report state to the undo buffer and updates all plugins.
SetModified(Object, String)
Call this method if you change something in the report.
Declaration
public void SetModified(object sender, string action)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The object that was modified. |
| System.String | action | The undo action name. |
Remarks
This method adds the current report state to the undo buffer and updates all plugins.
SetModified(Object, String, String)
Call this method if you change something in the report.
Declaration
public void SetModified(object sender, string action, string objName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The object that was modified. |
| System.String | action | The undo action name. |
| System.String | objName | The name of modified object. |
ShowMessage(String)
Displays a message in the "Messages" window.
Declaration
public void ShowMessage(string msg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | msg | Message text. |
ShowStatus(String, String, String, String)
Shows the selected object's information in the designer's statusbar.
Declaration
public virtual void ShowStatus(string location, string size, string text, string locationRightBot)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | location | Object's location. |
| System.String | size | Object's size. |
| System.String | text | Textual information about the selected object. |
| System.String | locationRightBot | The location of the lower-right corner of the object's. |
StartAutoSave()
AutoSave system initialization.
Declaration
public void StartAutoSave()
StopAutoSave()
Stops the AutoSave system.
Declaration
public void StopAutoSave()
Unlock()
Unlocks all plugins.
Declaration
public void Unlock()
Remarks
Call this method after the Lock.
UpdateDpiDependencies(Object)
Updates layout and images on dpi change.
Declaration
public virtual void UpdateDpiDependencies(object sender)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The sender object. |
UpdatePlugins(Object)
Call this method to refresh all plugins' content.
Declaration
public void UpdatePlugins(object sender)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The plugin that we don't need to refresh. |
UpdateUIStyle()
Updates UI style of the designer.
Declaration
public virtual void UpdateUIStyle()
ZoomPageWidth()
Zooms the report to page width.
Declaration
public void ZoomPageWidth()
ZoomWholePage()
Zooms the report to whole page.
Declaration
public void ZoomWholePage()
Events
LayoutChangedEvent
Fires when the layout is changed.
Declaration
public event EventHandler LayoutChangedEvent
Event Type
| Type | Description |
|---|---|
| System.EventHandler |
Remarks
This event is for internal use only.
UIStateChanged
Occurs when designer's UI state changed.
Declaration
public event EventHandler UIStateChanged
Event Type
| Type | Description |
|---|---|
| System.EventHandler |
UIStyleChanged
Occurs when the UIStyle property is changed.
Declaration
public event EventHandler UIStyleChanged
Event Type
| Type | Description |
|---|---|
| System.EventHandler |