⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 report1.cs

📁 这个是当年毕业设计的参考资料
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Data;

namespace SKXT
{
	/// <summary>
	/// Summary description for XtraReport1.
	/// </summary>
	public class XtraReport1 : DevExpress.XtraReports.UI.XtraReport
	{
		private DevExpress.XtraReports.UI.DetailBand Detail;
		private DevExpress.XtraReports.UI.PageHeaderBand PageHeader;
		private DevExpress.XtraReports.UI.PageFooterBand PageFooter;
		private DevExpress.XtraReports.UI.XRLabel xrLabel1;
		private DevExpress.XtraReports.UI.XRTable xrTable1;
		private DevExpress.XtraReports.UI.XRTableRow xrTableRow1;
		private DevExpress.XtraReports.UI.XRTableCell xrTableCell1;
		private DevExpress.XtraReports.UI.XRTableCell xrTableCell2;
		private DevExpress.XtraReports.UI.XRTableCell xrTableCell3;
		private DevExpress.XtraReports.UI.XRTable xrTable2;
		private DevExpress.XtraReports.UI.XRTableRow xrTableRow2;
		private DevExpress.XtraReports.UI.XRTableCell skmc;
		private DevExpress.XtraReports.UI.XRTableCell skbm;
		private DevExpress.XtraReports.UI.XRTableCell id;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public  XtraReport1(DataTable dtPrint)
		{
			/// <summary>
			/// Required for Windows.Forms Class Composition Designer support
			/// </summary>
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//

			PrintInit(dtPrint);
			
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		void PrintInit(DataTable dt )
		{
			//OpPrint.CnReport(this.PrintingSystem);	//本地化报表预览控件	
			//OpPrint.pp = this.PrintingSystem;
			
			this.skbm.DataBindings.Add(	"Text",dt,dt.Columns["skbm"].ToString(),"");	
	
			//把dt中的列绑定到报表中的对应的列
			this.skmc.DataBindings.Add("Text",dt,dt.Columns["skmc"].ToString(),"");
			this.id.DataBindings.Add("Text",dt,dt.Columns["id"].ToString(),"");
		

			this.DataSource = dt;

			

		}
		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.Detail = new DevExpress.XtraReports.UI.DetailBand();
			this.PageHeader = new DevExpress.XtraReports.UI.PageHeaderBand();
			this.PageFooter = new DevExpress.XtraReports.UI.PageFooterBand();
			this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel();
			this.xrTable1 = new DevExpress.XtraReports.UI.XRTable();
			this.xrTableRow1 = new DevExpress.XtraReports.UI.XRTableRow();
			this.xrTableCell1 = new DevExpress.XtraReports.UI.XRTableCell();
			this.xrTableCell2 = new DevExpress.XtraReports.UI.XRTableCell();
			this.xrTableCell3 = new DevExpress.XtraReports.UI.XRTableCell();
			this.xrTable2 = new DevExpress.XtraReports.UI.XRTable();
			this.xrTableRow2 = new DevExpress.XtraReports.UI.XRTableRow();
			this.skmc = new DevExpress.XtraReports.UI.XRTableCell();
			this.skbm = new DevExpress.XtraReports.UI.XRTableCell();
			this.id = new DevExpress.XtraReports.UI.XRTableCell();
			((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.xrTable2)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
			// 
			// Detail
			// 
			this.Detail.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] {
																						this.xrTable2});
			this.Detail.Name = "Detail";
			// 
			// PageHeader
			// 
			this.PageHeader.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] {
																							this.xrTable1,
																							this.xrLabel1});
			this.PageHeader.Height = 59;
			this.PageHeader.Name = "PageHeader";
			// 
			// PageFooter
			// 
			this.PageFooter.Height = 30;
			this.PageFooter.Name = "PageFooter";
			// 
			// xrLabel1
			// 
			this.xrLabel1.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.xrLabel1.Location = new System.Drawing.Point(283, 0);
			this.xrLabel1.Name = "xrLabel1";
			this.xrLabel1.ParentStyleUsing.UseFont = false;
			this.xrLabel1.Size = new System.Drawing.Size(134, 33);
			this.xrLabel1.Text = "水库报表";
			// 
			// xrTable1
			// 
			this.xrTable1.Location = new System.Drawing.Point(17, 33);
			this.xrTable1.Name = "xrTable1";
			this.xrTable1.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] {
																					   this.xrTableRow1});
			this.xrTable1.Size = new System.Drawing.Size(558, 26);
			// 
			// xrTableRow1
			// 
			this.xrTableRow1.Cells.AddRange(new DevExpress.XtraReports.UI.XRTableCell[] {
																							this.xrTableCell1,
																							this.xrTableCell2,
																							this.xrTableCell3});
			this.xrTableRow1.Name = "xrTableRow1";
			this.xrTableRow1.Size = new System.Drawing.Size(558, 26);
			// 
			// xrTableCell1
			// 
			this.xrTableCell1.Location = new System.Drawing.Point(0, 0);
			this.xrTableCell1.Name = "xrTableCell1";
			this.xrTableCell1.Size = new System.Drawing.Size(186, 26);
			this.xrTableCell1.Text = "水库名";
			// 
			// xrTableCell2
			// 
			this.xrTableCell2.Location = new System.Drawing.Point(186, 0);
			this.xrTableCell2.Name = "xrTableCell2";
			this.xrTableCell2.Size = new System.Drawing.Size(186, 26);
			this.xrTableCell2.Text = "水库编码";
			// 
			// xrTableCell3
			// 
			this.xrTableCell3.Location = new System.Drawing.Point(372, 0);
			this.xrTableCell3.Name = "xrTableCell3";
			this.xrTableCell3.Size = new System.Drawing.Size(186, 26);
			this.xrTableCell3.Text = "水库ID";
			// 
			// xrTable2
			// 
			this.xrTable2.Location = new System.Drawing.Point(17, 0);
			this.xrTable2.Name = "xrTable2";
			this.xrTable2.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] {
																					   this.xrTableRow2});
			this.xrTable2.Size = new System.Drawing.Size(558, 26);
			// 
			// xrTableRow2
			// 
			this.xrTableRow2.Cells.AddRange(new DevExpress.XtraReports.UI.XRTableCell[] {
																							this.skmc,
																							this.skbm,
																							this.id});
			this.xrTableRow2.Name = "xrTableRow2";
			this.xrTableRow2.Size = new System.Drawing.Size(558, 26);
			// 
			// skmc
			// 
			this.skmc.Location = new System.Drawing.Point(0, 0);
			this.skmc.Name = "skmc";
			this.skmc.Size = new System.Drawing.Size(186, 26);
			this.skmc.Text = "skmc";
			// 
			// skbm
			// 
			this.skbm.Location = new System.Drawing.Point(186, 0);
			this.skbm.Name = "skbm";
			this.skbm.Size = new System.Drawing.Size(186, 26);
			this.skbm.Text = "skbm";
			// 
			// id
			// 
			this.id.Location = new System.Drawing.Point(372, 0);
			this.id.Name = "id";
			this.id.Size = new System.Drawing.Size(186, 26);
			this.id.Text = "id";
			// 
			// XtraReport1
			// 
			this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] {
																		 this.Detail,
																		 this.PageHeader,
																		 this.PageFooter});
			((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.xrTable2)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this)).EndInit();

		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -