├── README.md ├── src ├── FastReport.OpenSource.Winforms │ ├── window_print.bmp │ ├── print_preview.bmp │ ├── Resources │ │ ├── print_16.png │ │ ├── window_print.bmp │ │ ├── print_help_16.png │ │ ├── print_preview.bmp │ │ └── print_setup_16.png │ ├── ZoomMode.cs │ ├── FastReport.OpenSource.Winforms.csproj │ ├── FRPreview.Designer.cs │ ├── FRPrintPreviewDialog.Designer.cs │ ├── Extensions.cs │ ├── FRPrintPreviewDialog.cs │ ├── FRPreview.resx │ ├── FRPrintPreviewDialog.resx │ ├── FRPrintPreviewControl.cs │ ├── FRPrintPreviewControl.resx │ ├── FRPrintPreviewControl.Designer.cs │ └── FRPreview.cs ├── FastReport.OpenSource.Winforms.Demo │ ├── Resources │ │ ├── 068.png │ │ ├── frst.png │ │ ├── lst.png │ │ ├── nxt.png │ │ └── prr.png │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── App.config │ ├── Program.cs │ ├── Form1.cs │ ├── Form1.Designer.cs │ ├── Reports │ │ ├── Lines and Shapes.frx │ │ ├── Polygon.frx │ │ ├── CheckBox.frx │ │ ├── Master-Detail.frx │ │ ├── Image.frx │ │ ├── Pharmacode.frx │ │ └── Matrix.frx │ ├── Form1.resx │ └── FastReport.OpenSource.Winforms.Demo.csproj └── FastReport.OpenSource.Winforms.sln ├── LICENSE ├── .gitattributes └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | # FastReport.OpenSource.Winforms 2 | Métodos de extensão para impressão direta e preview para o FastReport.OpenSource para Winforms .NET Core/.NET. 3 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/window_print.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms/window_print.bmp -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/print_preview.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms/print_preview.bmp -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Resources/068.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms.Demo/Resources/068.png -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Resources/frst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms.Demo/Resources/frst.png -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Resources/lst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms.Demo/Resources/lst.png -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Resources/nxt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms.Demo/Resources/nxt.png -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Resources/prr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms.Demo/Resources/prr.png -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/Resources/print_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms/Resources/print_16.png -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/Resources/window_print.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms/Resources/window_print.bmp -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/Resources/print_help_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms/Resources/print_help_16.png -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/Resources/print_preview.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms/Resources/print_preview.bmp -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/Resources/print_setup_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rftd/FastReport.OpenSource.Winforms/HEAD/src/FastReport.OpenSource.Winforms/Resources/print_setup_16.png -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace WinFormsOpenSource 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/ZoomMode.cs: -------------------------------------------------------------------------------- 1 | namespace FastReport.OpenSource.Winforms 2 | { 3 | public enum ZoomMode 4 | { 5 | /// 6 | /// Show the preview in actual size. 7 | /// 8 | ActualSize, 9 | 10 | /// 11 | /// Show a full page. 12 | /// 13 | FullPage, 14 | 15 | /// 16 | /// Show a full page width. 17 | /// 18 | PageWidth, 19 | 20 | /// 21 | /// Show two full pages. 22 | /// 23 | TwoPages, 24 | 25 | /// 26 | /// Use the zoom factor specified by the property. 27 | /// 28 | Custom 29 | } 30 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Rafael Teno Dias 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WinFormsOpenSource.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/FastReport.OpenSource.Winforms.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Library 5 | net4;netcoreapp3.1 6 | true 7 | FastReport.OpenSource.Winforms 8 | FastReport.OpenSource.Winforms 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/FRPreview.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace FastReport.OpenSource.Winforms 2 | { 3 | partial class FRPreview 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // FRPreview 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.Name = "FRPreview"; 38 | this.Size = new System.Drawing.Size(243, 139); 39 | this.ResumeLayout(false); 40 | 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("WinFormsOpenSource")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("WinFormsOpenSource")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b98f7d90-37f1-4bc8-a7e2-48922fb67452")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Drawing; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Windows.Forms; 8 | using FastReport; 9 | using FastReport.OpenSource.Winforms; 10 | using FastReport.Utils; 11 | 12 | namespace WinFormsOpenSource 13 | { 14 | public partial class Form1 : Form 15 | { 16 | public string ReportsPath = Config.ApplicationFolder + @"..\..\Reports\"; 17 | 18 | public Form1() 19 | { 20 | InitializeComponent(); 21 | LoadReportList(); 22 | } 23 | 24 | public Report Report { get; set; } = new Report(); 25 | 26 | public void LoadReportList() 27 | { 28 | var filesname = Directory.GetFiles(ReportsPath, "*.frx").ToList(); 29 | 30 | foreach (var file in filesname) 31 | { 32 | ReportsList.Items.Add(Path.GetFileNameWithoutExtension(file)); 33 | } 34 | } 35 | 36 | private void ReportsList_SelectedIndexChanged(object sender, EventArgs e) 37 | { 38 | if (ReportsList.SelectedItem == null) return; 39 | Report.Load(ReportsPath + ReportsList.SelectedItem.ToString() + ".frx"); //Загружаем шаблон отчета 40 | DataSet data = new DataSet(); //Создаем источник данных 41 | data.ReadXml(ReportsPath + "nwind.xml"); //Загружаем в источник данных базу 42 | Report.RegisterData(data, "NorthWind"); //Регистрируем источник данных в отчете 43 | Report.Prepare(); //Выполняем предварительное построение отчета 44 | Report.Preview(frPrintPreviewControl1); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastReport.OpenSource.Winforms", "FastReport.OpenSource.Winforms\FastReport.OpenSource.Winforms.csproj", "{72D2953C-EC73-483F-ADC3-AEBA2C29F05E}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastReport.OpenSource.Winforms.Demo", "FastReport.OpenSource.Winforms.Demo\FastReport.OpenSource.Winforms.Demo.csproj", "{B98F7D90-37F1-4BC8-A7E2-48922FB67452}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {0F4EEBEE-2B8D-4AB0-BDE7-11EB587A55DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {0F4EEBEE-2B8D-4AB0-BDE7-11EB587A55DD}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {0F4EEBEE-2B8D-4AB0-BDE7-11EB587A55DD}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {0F4EEBEE-2B8D-4AB0-BDE7-11EB587A55DD}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {B98F7D90-37F1-4BC8-A7E2-48922FB67452}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {B98F7D90-37F1-4BC8-A7E2-48922FB67452}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {B98F7D90-37F1-4BC8-A7E2-48922FB67452}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {B98F7D90-37F1-4BC8-A7E2-48922FB67452}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {72D2953C-EC73-483F-ADC3-AEBA2C29F05E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {72D2953C-EC73-483F-ADC3-AEBA2C29F05E}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {72D2953C-EC73-483F-ADC3-AEBA2C29F05E}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {72D2953C-EC73-483F-ADC3-AEBA2C29F05E}.Release|Any CPU.Build.0 = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | GlobalSection(ExtensibilityGlobals) = postSolution 33 | SolutionGuid = {A911D402-3872-4AB7-9A8E-030761A8427D} 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/FRPrintPreviewDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace FastReport.OpenSource.Winforms 2 | { 3 | partial class FRPrintPreviewDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.preview = new FRPrintPreviewControl(); 32 | this.SuspendLayout(); 33 | // 34 | // preview 35 | // 36 | this.preview.Dock = System.Windows.Forms.DockStyle.Fill; 37 | this.preview.Document = null; 38 | this.preview.Location = new System.Drawing.Point(0, 0); 39 | this.preview.Name = "preview"; 40 | this.preview.ShowToolbar = true; 41 | this.preview.Size = new System.Drawing.Size(565, 364); 42 | this.preview.TabIndex = 0; 43 | // 44 | // FRPrintPreviewDialog 45 | // 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 48 | this.ClientSize = new System.Drawing.Size(565, 364); 49 | this.Controls.Add(this.preview); 50 | this.Name = "FRPrintPreviewDialog"; 51 | this.Text = "G2iPrintPreviewDialog"; 52 | this.WindowState = System.Windows.Forms.FormWindowState.Maximized; 53 | this.ResumeLayout(false); 54 | 55 | } 56 | 57 | #endregion 58 | 59 | private FRPrintPreviewControl preview; 60 | } 61 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | using FastReport.OpenSource.Winforms; 2 | 3 | namespace WinFormsOpenSource 4 | { 5 | partial class Form1 6 | { 7 | /// 8 | /// Required designer variable. 9 | /// 10 | private System.ComponentModel.IContainer components = null; 11 | 12 | /// 13 | /// Clean up any resources being used. 14 | /// 15 | /// true if managed resources should be disposed; otherwise, false. 16 | protected override void Dispose(bool disposing) 17 | { 18 | if (disposing && (components != null)) 19 | { 20 | components.Dispose(); 21 | } 22 | base.Dispose(disposing); 23 | } 24 | 25 | #region Windows Form Designer generated code 26 | 27 | /// 28 | /// Required method for Designer support - do not modify 29 | /// the contents of this method with the code editor. 30 | /// 31 | private void InitializeComponent() 32 | { 33 | this.ReportsList = new System.Windows.Forms.ListBox(); 34 | this.frPrintPreviewControl1 = new FastReport.OpenSource.Winforms.FRPrintPreviewControl(); 35 | this.SuspendLayout(); 36 | // 37 | // ReportsList 38 | // 39 | this.ReportsList.Dock = System.Windows.Forms.DockStyle.Left; 40 | this.ReportsList.FormattingEnabled = true; 41 | this.ReportsList.Location = new System.Drawing.Point(0, 0); 42 | this.ReportsList.Name = "ReportsList"; 43 | this.ReportsList.Size = new System.Drawing.Size(190, 476); 44 | this.ReportsList.TabIndex = 3; 45 | this.ReportsList.SelectedIndexChanged += new System.EventHandler(this.ReportsList_SelectedIndexChanged); 46 | // 47 | // frPrintPreviewControl1 48 | // 49 | this.frPrintPreviewControl1.Dock = System.Windows.Forms.DockStyle.Fill; 50 | this.frPrintPreviewControl1.Document = null; 51 | this.frPrintPreviewControl1.Location = new System.Drawing.Point(190, 0); 52 | this.frPrintPreviewControl1.Name = "frPrintPreviewControl1"; 53 | this.frPrintPreviewControl1.ShowToolbar = true; 54 | this.frPrintPreviewControl1.Size = new System.Drawing.Size(509, 476); 55 | this.frPrintPreviewControl1.TabIndex = 4; 56 | // 57 | // Form1 58 | // 59 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 60 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 61 | this.ClientSize = new System.Drawing.Size(699, 476); 62 | this.Controls.Add(this.frPrintPreviewControl1); 63 | this.Controls.Add(this.ReportsList); 64 | this.Name = "Form1"; 65 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 66 | this.Text = "Report viewer"; 67 | this.WindowState = System.Windows.Forms.FormWindowState.Maximized; 68 | this.ResumeLayout(false); 69 | 70 | } 71 | 72 | #endregion 73 | private System.Windows.Forms.ListBox ReportsList; 74 | private FRPrintPreviewControl frPrintPreviewControl1; 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Reports/Lines and Shapes.frx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Drawing.Printing; 3 | using System.IO; 4 | using System.Windows.Forms; 5 | using FastReport.Export; 6 | using FastReport.Export.Image; 7 | using FastReport.Utils; 8 | 9 | namespace FastReport.OpenSource.Winforms 10 | { 11 | public static class Extensions 12 | { 13 | #region Fields 14 | 15 | private const float scaleFactor = 300 / 96f; 16 | 17 | #endregion Fields 18 | 19 | #region Methods 20 | 21 | public static void PrintWithDialog(this Report report) 22 | { 23 | using (var dlg = new PrintDialog()) 24 | { 25 | dlg.AllowSomePages = true; 26 | dlg.AllowSelection = true; 27 | dlg.UseEXDialog = true; 28 | 29 | if (dlg.ShowDialog() != DialogResult.OK) return; 30 | 31 | report.Print(dlg.PrinterSettings); 32 | } 33 | } 34 | 35 | public static void Print(this Report report, PrinterSettings settings = null) 36 | { 37 | var doc = report.PrepareDoc(settings); 38 | if (doc == null) return; 39 | 40 | doc.Print(); 41 | doc.Dispose(); 42 | } 43 | 44 | public static void Preview(this Report report, FRPrintPreviewControl preview, PrinterSettings settings = null) 45 | { 46 | var doc = report.PrepareDoc(settings); 47 | if (doc == null) return; 48 | 49 | preview.Document = doc; 50 | } 51 | 52 | public static void Preview(this Report report, PrinterSettings settings = null) 53 | { 54 | var doc = report.PrepareDoc(settings); 55 | if (doc == null) return; 56 | 57 | using (var preview = new FRPrintPreviewDialog() { Document = doc }) 58 | preview.ShowDialog(); 59 | doc.Dispose(); 60 | } 61 | 62 | private static PrintDocument PrepareDoc(this Report report, PrinterSettings settings = null) 63 | { 64 | if (report.PreparedPages.Count < 1) 65 | { 66 | report.Prepare(); 67 | if (report.PreparedPages.Count < 1) return null; 68 | } 69 | 70 | var page = 0; 71 | var exp = new ImageExport { ImageFormat = ImageExportFormat.Png, Resolution = 600 }; 72 | 73 | var doc = new PrintDocument { DocumentName = report.Name }; 74 | if (settings != null) 75 | doc.PrinterSettings = settings; 76 | 77 | // Ajustando o tamanho da pagina 78 | doc.QueryPageSettings += (sender, args) => 79 | { 80 | var rPage = report.PreparedPages.GetPage(page); 81 | args.PageSettings.Landscape = rPage.Landscape; 82 | args.PageSettings.Margins = new Margins((int)(scaleFactor * rPage.LeftMargin * Units.HundrethsOfInch), 83 | (int)(scaleFactor * rPage.RightMargin * Units.HundrethsOfInch), 84 | (int)(scaleFactor * rPage.TopMargin * Units.HundrethsOfInch), 85 | (int)(scaleFactor * rPage.BottomMargin * Units.HundrethsOfInch)); 86 | 87 | args.PageSettings.PaperSize = new PaperSize("Custom", (int)(ExportUtils.GetPageWidth(rPage) * scaleFactor * Units.HundrethsOfInch), 88 | (int)(ExportUtils.GetPageHeight(rPage) * scaleFactor * Units.HundrethsOfInch)); 89 | }; 90 | 91 | doc.PrintPage += (sender, args) => 92 | { 93 | using (var ms = new MemoryStream()) 94 | { 95 | exp.PageRange = PageRange.PageNumbers; 96 | exp.PageNumbers = $"{page + 1}"; 97 | exp.Export(report, ms); 98 | 99 | args.Graphics.DrawImage(Image.FromStream(ms), args.PageBounds); 100 | } 101 | 102 | page++; 103 | 104 | args.HasMorePages = page < report.PreparedPages.Count; 105 | }; 106 | 107 | doc.EndPrint += (sender, args) => page = 0; 108 | doc.Disposed += (sender, args) => exp?.Dispose(); 109 | 110 | return doc; 111 | } 112 | 113 | #endregion Methods 114 | } 115 | } -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Reports/Polygon.frx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WinFormsOpenSource.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinFormsOpenSource.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap _068 { 67 | get { 68 | object obj = ResourceManager.GetObject("068", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap frst { 77 | get { 78 | object obj = ResourceManager.GetObject("frst", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Bitmap. 85 | /// 86 | internal static System.Drawing.Bitmap lst { 87 | get { 88 | object obj = ResourceManager.GetObject("lst", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap nxt { 97 | get { 98 | object obj = ResourceManager.GetObject("nxt", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | 103 | /// 104 | /// Looks up a localized resource of type System.Drawing.Bitmap. 105 | /// 106 | internal static System.Drawing.Bitmap prr { 107 | get { 108 | object obj = ResourceManager.GetObject("prr", resourceCulture); 109 | return ((System.Drawing.Bitmap)(obj)); 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Reports/CheckBox.frx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms/FRPrintPreviewDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Drawing.Printing; 6 | using System.Windows.Forms; 7 | 8 | namespace FastReport.OpenSource.Winforms 9 | { 10 | [ToolboxBitmap(typeof(FRPrintPreviewDialog), @"FastReport.OpenSource.Winforms.Print.window_print.bmp"), 11 | DesignerCategory(@"FastReport.OpenSource.Winforms"), DesignTimeVisible(true), ToolboxItem(true), 12 | Designer("System.ComponentModel.Design.ComponentDesigner"), 13 | ToolboxItemFilter("System.Windows.Forms.Control.TopLevel")] 14 | public partial class FRPrintPreviewDialog : Form 15 | { 16 | #region Constructors 17 | 18 | public FRPrintPreviewDialog() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | #endregion Constructors 24 | 25 | #region Propriedades 26 | 27 | /// 28 | /// Gets or sets the being previewed. 29 | /// 30 | public PrintDocument Document { get; set; } 31 | 32 | /// 33 | /// Gets a value that indicates whether the is being rendered. 34 | /// 35 | [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] 36 | public bool IsRendering => preview.IsRendering; 37 | 38 | /// 39 | /// Gets or sets how the zoom should be adjusted when the control is resized. 40 | /// 41 | [DefaultValue(ZoomMode.FullPage)] 42 | public ZoomMode ZoomMode 43 | { 44 | get => preview.ZoomMode; 45 | set => preview.ZoomMode = value; 46 | } 47 | 48 | /// 49 | /// Gets or sets a custom zoom factor used when the property 50 | /// is set to Custom. 51 | /// 52 | [Browsable(false), 53 | DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] 54 | public double Zoom 55 | { 56 | get => preview.Zoom; 57 | set => preview.Zoom = value; 58 | } 59 | 60 | /// 61 | /// Gets or sets the first page being previewed. 62 | /// 63 | /// 64 | /// There may be one or two pages visible depending on the setting of the 65 | /// property. 66 | /// 67 | [Browsable(false), 68 | DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] 69 | public int StartPage 70 | { 71 | get => preview.StartPage; 72 | set => preview.StartPage = value; 73 | } 74 | 75 | /// 76 | /// Gets the number of pages available for preview. 77 | /// 78 | /// 79 | /// This number increases as the document is rendered into the control. 80 | /// 81 | [Browsable(false), 82 | DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] 83 | public int PageCount => preview.PageCount; 84 | 85 | /// 86 | /// Gets or sets the control's background color. 87 | /// 88 | [DefaultValue(typeof(Color), "AppWorkspace")] 89 | public sealed override Color BackColor 90 | { 91 | get => preview.BackColor; 92 | set => preview.BackColor = value; 93 | } 94 | 95 | #endregion Propriedades 96 | 97 | #region Overloads 98 | 99 | /// 100 | /// Creates the handle for the form. If a derived class overrides this function, it must call the base implementation. 101 | /// 102 | /// 103 | protected override void CreateHandle() 104 | { 105 | // We want to check printer settings before we push the modal message loop, 106 | // so the user has a chance to catch the exception instead of letting go to 107 | // the windows forms exception dialog. 108 | if (Document != null && !Document.PrinterSettings.IsValid) 109 | throw new InvalidPrinterException(Document.PrinterSettings); 110 | 111 | base.CreateHandle(); 112 | } 113 | 114 | /// 115 | /// Overridden to assign document to preview control only after the 116 | /// initial activation. 117 | /// 118 | /// that contains the event data. 119 | protected override void OnShown(EventArgs e) 120 | { 121 | base.OnShown(e); 122 | preview.Document = Document; 123 | } 124 | 125 | /// 126 | /// Overridden to cancel any ongoing previews when closing form. 127 | /// 128 | /// that contains the event data. 129 | protected override void OnFormClosing(FormClosingEventArgs e) 130 | { 131 | base.OnFormClosing(e); 132 | if (preview.IsRendering && !e.Cancel) 133 | { 134 | preview.Cancel(); 135 | } 136 | } 137 | 138 | #endregion Overloads 139 | } 140 | } -------------------------------------------------------------------------------- /src/FastReport.OpenSource.Winforms.Demo/Reports/Master-Detail.frx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |