using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace ryPrint { [DefaultPropertyAttribute("Name")] public class ClsProperty { private string _Name = ""; [ReadOnlyAttribute(true),DescriptionAttribute("显示的控件ID")] public string Name { get { return _Name; } set { _Name = value; } } private string _Title = "自定义"; [CategoryAttribute("内容"), DescriptionAttribute("显示的名称,只在类型为自定义时生效")] public string Title { get { if (Type == ClsProperty.En_Type.自定义 || Type == ClsProperty.En_Type.数据字段) { return _Title; } else { return Enum.GetName(typeof(ClsProperty.En_Type), Type); } } set { _Title = value; } } public enum En_Type { 自定义 = 0, 数据字段=12 } private En_Type _Type = En_Type.自定义; [CategoryAttribute("内容"), DescriptionAttribute("当前控件的类型,当为数据类型时,将对数据进行分行打印")] public En_Type Type { get { return _Type; } set { _Type = value; } } private string _CustomFormat= ""; [CategoryAttribute("内容"), DescriptionAttribute("显示的内容格式,只在类型为自定义时生效,支持时间格式化")] public string CustomFormat { get { return _CustomFormat; } set { _CustomFormat = value; } } private string _Value = ""; [CategoryAttribute("内容"), DescriptionAttribute("显示的内容,只在类型为自定义或数据字段,且内容格式为空时生效。当为数据类型时,该值表示数据集合的列名,通常等于表的列名")] public string Value { get { return _Value; } set { _Value = value; } } private double _LineSpace = 2; [CategoryAttribute("内容"), DescriptionAttribute("行距(单位为毫米),只在类型为数据字段时才有效,表示每项数据之间隔开的行距")] public double LineSpace { get { return _LineSpace; } set { _LineSpace = value; } } private int _PageCount = 0; [CategoryAttribute("内容"), DescriptionAttribute("每页显示的数量,只在类型为数据字段时才有效,为0则表示打印所有数据。")] public int PageCount { get { return _PageCount; } set { _PageCount = value; } } private string _DataSource =""; [CategoryAttribute("内容"), DescriptionAttribute("数据源;为空则表示默认数据源.")] public string DataSource { get { return _DataSource; } set { _DataSource = value; } } private PointF _postion =new PointF(0,0); /// /// 当前控件所属的位置,单位是毫米 /// [CategoryAttribute("基本属性"), DescriptionAttribute("当前控件所属的位置,单位是毫米")] public PointF Postion { get { return _postion; } set { _postion = value; } } /// /// 当前控件所属的位置,单位是毫米 /// [CategoryAttribute("基本属性"), DescriptionAttribute("当前控件所属的距顶部位置,单位是毫米")] public float Top { get { return _postion.Y; } set { _postion.Y = value; } } /// /// 当前控件所属的位置,单位是毫米 /// [CategoryAttribute("基本属性"), DescriptionAttribute("当前控件所属的距左边位置,单位是毫米")] public float Left { get { return _postion.X; } set { _postion.X = value; } } [CategoryAttribute("基本属性"), DescriptionAttribute("当前字符串显示方式")] public HorizontalAlignment Align { get; set; } = HorizontalAlignment.Left; private bool _multiline =false; [CategoryAttribute("基本属性"), DescriptionAttribute("是否允许多行选择")] public bool Multiline { get { return _multiline; } set { _multiline = value; } } private bool _NoPrint = false; [CategoryAttribute("基本属性"), DescriptionAttribute("只在预览中打印")] public bool NoPrint { get { return _NoPrint; } set { _NoPrint = value; } } private float _fontsize = 10; [CategoryAttribute("基本属性"), DescriptionAttribute("当前控件字体大小")] public float FontSize { get { return _fontsize; } set { _fontsize = value; } } private SizeF _Size = new SizeF(); [CategoryAttribute("基本属性"), DescriptionAttribute("控件大小,单位是毫米")] public SizeF Size { get { return _Size; } set { _Size = value; } } } }