using System;
using System.Drawing;
using GwmPrinter.Object;
namespace GwmPrinter
{
///
/// 用来创建一个报表对象的类
///
public class Report
{
#region ************字 段************
private System.Drawing.Printing.Margins mPrinterMargins; //打印边距
private bool _IsLandscape; //页面放置 默认纵向
private System.Drawing.Printing.PaperSize pagesize; //纸张大小
private bool _IsAlwaysShowAbove; //是否每页都显示标题 默认是
private Title title; //标题
private bool _IsShowPageMsg; //是否显示分页信息
private bool _IsMarginEveryPage;
private Font PageMsgfont;
private Caption caption;
private Top top;
private Header header;
private Body body;
private Footer footer;
private int _CellMargin; //字和边框的距离。紧临会出现字体显示不清楚
#endregion ************字 段************
#region 构造函数
///
/// 默认构造函数,边距一英寸
///
public Report()
{
_IsAlwaysShowAbove = true;
mPrinterMargins = new System.Drawing.Printing.Margins(60,60,60,0);
pagesize = new System.Drawing.Printing.PaperSize("委托书",500,900);
this._IsShowPageMsg = false;
this._IsMarginEveryPage = false;
title = null;
caption = null;
top = null;
header = null;
body = null;
footer = null;
_IsLandscape = true;
PageMsgfont= new Font("宋体",10);
_CellMargin = 4;
}
///
/// 默认构造函数,边距一英寸
///
public Report(Title _title,Caption _caption,Top _top,Header _header,Body _body,Footer _footer)
{
_IsAlwaysShowAbove = true;
mPrinterMargins = new System.Drawing.Printing.Margins(60,60,60,0);
pagesize = new System.Drawing.Printing.PaperSize("委托书",900,500);
this._IsMarginEveryPage = false;
title = _title;
caption = _caption;
top = _top;
header = _header;
body = _body;
footer = _footer;
this._IsShowPageMsg = footer.IsShowPageMsg;
_IsLandscape = true;
PageMsgfont= new Font("宋体",10);
_CellMargin = 2;
}
///
/// 自定义构造函数
///
/// 页边距
/// 是否每页都显示标题 默认是
/// 页面大小
public Report(System.Drawing.Printing.Margins mPrinterMargins,bool IsAlwaysShowTile,System.Drawing.Printing.PaperSize pagesize)
{
this._IsAlwaysShowAbove = IsAlwaysShowTile;
this.mPrinterMargins = mPrinterMargins;
this.pagesize = pagesize;
this._IsShowPageMsg = false;
this._IsMarginEveryPage = false;
_IsLandscape = true;
title = null;
caption = null;
top = null;
header = null;
body = null;
footer = null;
PageMsgfont= new Font("宋体",10);
_CellMargin = 2;
}
#endregion
#region 获取或是设置属性
///
/// 获取或是设置页码信息的font值
///
public Font Font
{
set
{
this.PageMsgfont = value;
}
get
{
return this.PageMsgfont;
}
}
///
/// 获取或是设置页的CellMargin值
///
public int CellMargin
{
set
{
this._CellMargin = value;
}
get
{
return this._CellMargin;
}
}
///
/// 获取或是设置Margins值
///
public System.Drawing.Printing.Margins Margins
{
set
{
this.mPrinterMargins = value;
}
get
{
return this.mPrinterMargins;
}
}
///
/// 获取或是设置PageSize值
///
public System.Drawing.Printing.PaperSize PageSize
{
set
{
this.pagesize = value;
}
get
{
return this.pagesize;
}
}
///
/// 获取或设置_IsMarginEveryPage值
///
public bool IsMarginEveryPage
{
set
{
this._IsMarginEveryPage = value;
}
get
{
return this._IsMarginEveryPage;
}
}
///
/// 获取_IsShowPageMsg值
///
public bool IsShowPageMsg
{
get
{
return this._IsShowPageMsg;
}
}
///
/// 获取或设置_IsLandscape值
///
public bool IsLandscape
{
set
{
this._IsLandscape = value;
}
get
{
return this._IsLandscape;
}
}
///
/// 获取或设置IsAlwaysShowTile值
///
public bool IsAlwaysShowAbove
{
set
{
this._IsAlwaysShowAbove = value;
}
get
{
return this._IsAlwaysShowAbove;
}
}
#endregion
#region 获取或是设置OBJECT值
///
/// 获取或是设置Title值
///
public Title Title
{
set
{
this.title = value;
}
get
{
return this.title;
}
}
///
/// 获取或是设置Caption值
///
public Caption Caption
{
set
{
this.caption = value;
}
get
{
return this.caption;
}
}
///
/// 获取或是设置Top值
///
public Top Top
{
set
{
this.top = value;
}
get
{
return this.top;
}
}
///
/// 获取或是设置Header值
///
public Header Header
{
set
{
this.header = value;
}
get
{
return this.header;
}
}
///
/// 获取或是设置Body值
///
public Body Body
{
set
{
this.body = value;
}
get
{
return this.body;
}
}
///
/// 获取或是设置Footer值
///
public Footer Footer
{
set
{
this.footer = value;
this._IsShowPageMsg = this.footer.IsShowPageMsg;
}
get
{
return this.footer;
}
}
#endregion
}
}