ActiveReports Report Application tutorial (13) --- embed a third-party control

Source: Internet
Author: User

ActiveReports controls are perfectly integrated with Visual Studio to provide more flexible and easy-to-use report customization and custom control embedding support. In addition to using ActiveReports built-in controls in reports, you can also add any third party to the report. to meet your needs for more report expansion capabilities. This article shows how to use the C1Gauge for Windows Forms and C1Chart for Windows Forms controls in the ActiveReports regional report.

1. Create a report file

Create an ActiveReports report file named rptControls1.cs in the application, and the ActiveReports regional report (based on code ). Add C1.Win. C1Chart. 2.dll and C1.Win. C1Gauge. 2.dll references to the project.

2. design the report page

Note that in WinForms and ASP. the NET program is slightly different. When developing a WinForms application, switch to the report design interface. All available WinForms platform controls in your current environment are displayed in the Visual Studio toolbox, in this case, we can drag any other third-party controls to the ActiveReports area report design interface. In ASP. when the program is developed, the control of the WinForms platform is not displayed in the Visual Studio toolbox. Therefore, you cannot directly add a third-party control to the report design interface, we need to add the Picture control to the report design interface, and then load the third-party control in the background code.

Switch to the report design page and add the RichTextBox and Picture controls under the ActiveReports 7 regional layout Report category to the report.

Switch to the report background Code view and load the third-party control in the ReportStart event of the report. The Code is as follows:

 

// Add the C1Gauge control private void AddGauge1 () {C1.Win. c1Gauge. c1Gauge c1Gauge1 = new C1.Win. c1Gauge. c1Gauge (); c1Gauge1. load (string. format (@ "{0} \ Data \ C1RadialGauge1. xml ", BasePath); c1Gauge1. backColor = Color. white; c1Gauge1. gauges [0]. value = 80; c1Gauge1. gauges [1]. value = 88; c1Gauge1. gauges [2]. value = 75; picture1.Image = c1Gauge1. getImage (450,300);} // Add the C1Chart control private void AddChart1 () {C1.Win. c1Chart. c1Chart c1Chart = new C1.Win. c1Chart. c1Chart (); c1Chart. loadChartFromFile (string. format (@ "{0} Data \ C1Chart1. chart2dxml ", BasePath); picture2.Image = c1Chart. getImage (new Size (800,370);} private void rptControls1_ReportStart (object sender, EventArgs e) {AddGauge1 (); AddChart1 (); richTextBox1.LoadFile (string. format (@ "{0} Data \ supports third-party controls. rtf ", BasePath ));}

 

 

3. Run the program

650) this. width = 650; "width =" 644 "height =" 577 "title =" ActiveReports report function display embedded third-party controls "style =" border-width: 0px; display: inline; "alt =" ActiveReports report function show embedded third-party controls "src =" http://www.bkjia.com/uploads/allimg/131228/204312BV-0.png "border =" 0 "/>

Online Demo and source code:


Http://www.gcpowertools.com.cn/products/activereports_demo.htm
650) this. width = 650; "width =" 644 "height =" 508 "title =" ActiveReports report function display "style =" border: 0px currentcolor; display: inline; "alt =" ActiveReports report function display "src =" http://www.bkjia.com/uploads/allimg/131228/2043121K3-1.png "border =" 0 "/>

This article from the "grape city control blog" blog, please be sure to keep this source http://powertoolsteam.blog.51cto.com/2369428/1255864

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.