The famous Crystal Reports (Crystal Report) has been embedded in Microsoft Visual Studio. NET, while upgrading to Crystal Reports for Visual Studio. Net. Its advantages are: 1, in the. NET platform can easily create interactive, high-quality presentation of the content of the report, which is Crystal Reports has long been the main advantage; 2, using Crystal Reports for Visual Studio. NET, can be found in the We Platform B and Windows platform, and publish the Crystal report as a report Web service on the Web server, 3, using the Web application created by Crystal, allows users to drill down and filter information as needed. In. NET, a chart is actually a Crystal report that interacts with other controls in your application. Here I show you how to browse the Crystal Report in a Windows forms application.
Design steps:
1. Software environment: Requires the system to have the visual Studio. NET integrated development system installed, only the. NET Framework SDK does not implement this example, and becomes a. NET Framework SDK without a crystal report control.
2. Create a new Visual C # project Windows application, set up Form1 text= "Crystal Report Browser", Startposition=centerscreen//program began to appear in the center of the screen, other properties are maintained by default;
3. Drag a crystalreportviewer from the toolbox, a button, a OpenFileDialog, to the form.
The entire designer's form layout simply places the button1 in the middle of the bottom of the form, and no more redundant layouts are needed.
Set the CrystalReportViewer1 properties as follows:
This.crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
Dock mode to fill the entire form
Expand +dockpadding
This.crystalReportViewer1.DockPadding.Bottom = 50;
Bottom vacated area where button is placed
This.crystalReportViewer1.DockPadding.Left = 5;
This.crystalReportViewer1.DockPadding.Right = 5;
This.crystalReportViewer1.DockPadding.Top = 5;
This.crystalReportViewer1.ReportSource = null;
Do not load report resources first
Set the Button1 properties as follows:
This.button1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
Keep the bottom of the form fixed
This.button1.Text = "Open report";
OpenFileDialog1 is the control that opens the file, setting its properties as follows:
This.openFileDialog1.Filter
= "Crystal (*.rpt) |*.rpt| all Documents (*.*) |*.*";
Provides the file type for the Open File dialog box.
The default type is the first defined type of this string
This.openFileDialog1.Title = "Open Crystal Report";
Open the title of the file dialog box
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.