瀏覽代碼

后台打印

chenxy 6 年之前
父節點
當前提交
5176fe073e
共有 36 個文件被更改,包括 11169 次插入526 次删除
  1. 4 2
      DK.Basics/InvoiceLayout/InvoiceLayout.csproj
  2. 7 7
      DK.Service/BarcodePrintService/BarcodePrintLogic.cs
  3. 4 18
      DK.Service/BarcodePrintService/BarcodePrintService.csproj
  4. 1 1
      DK.Service/BarcodePrintService/InvoiceLayoutPrinter.cs
  5. 112 0
      DK.Service/InvoiceLayout/BarcodeDraw.cs
  6. 542 0
      DK.Service/InvoiceLayout/Common/LayoutCommon.cs
  7. 1225 0
      DK.Service/InvoiceLayout/Common/LayoutUtility.cs
  8. 160 0
      DK.Service/InvoiceLayout/DataModel/LayoutConsts.cs
  9. 408 0
      DK.Service/InvoiceLayout/DataModel/LayoutObjects.cs
  10. 29 0
      DK.Service/InvoiceLayout/DataModel/PropertyOfLayoutBox.cs
  11. 103 0
      DK.Service/InvoiceLayout/DataModel/TextRectangleF.cs
  12. 89 0
      DK.Service/InvoiceLayout/InvoiceLayout.csproj
  13. 1291 0
      DK.Service/InvoiceLayout/Items/DataGridItem/GridItem.cs
  14. 953 0
      DK.Service/InvoiceLayout/Items/DataGridItem/GridItemColumn.cs
  15. 554 0
      DK.Service/InvoiceLayout/Items/DataGridItem/GridItemColumnCollection.cs
  16. 410 0
      DK.Service/InvoiceLayout/Items/DataGridItem/PageNumItem.cs
  17. 351 0
      DK.Service/InvoiceLayout/Items/DataGridItem/TotalTextItem.cs
  18. 37 0
      DK.Service/InvoiceLayout/Items/EllipseItem.cs
  19. 221 0
      DK.Service/InvoiceLayout/Items/GraphicsItem.cs
  20. 6 0
      DK.Service/InvoiceLayout/Items/IBoundItem.cs
  21. 162 0
      DK.Service/InvoiceLayout/Items/ImageItem.cs
  22. 1069 0
      DK.Service/InvoiceLayout/Items/LayoutItem.cs
  23. 37 0
      DK.Service/InvoiceLayout/Items/RectangleItem.cs
  24. 1468 0
      DK.Service/InvoiceLayout/Items/TextItem.cs
  25. 36 0
      DK.Service/InvoiceLayout/Properties/AssemblyInfo.cs
  26. 二進制
      DLL/Curtain.DataAccess.dll
  27. 二進制
      DLL/Curtain.Framework.dll
  28. 二進制
      DLL/Curtain.Net.Sockets.dll
  29. 1359 0
      DLL/Curtain.Net.Sockets.xml
  30. 二進制
      DLL/zxing.dll
  31. 502 497
      DLL/zxing.xml
  32. 19 0
      IBOSS.PRD.sln
  33. 7 0
      IBOSS.PRD/IBOSS.PRD.csproj
  34. 1 0
      WCF.Service/WCF.Services/PDAModuleService.cs
  35. 1 0
      WCF.Service/WCF.Services/PDAModuleServiceGet.cs
  36. 1 1
      WCF.Service/WCF.Services/SmartDeviceService.cs

+ 4 - 2
DK.Basics/InvoiceLayout/InvoiceLayout.csproj

@@ -76,7 +76,8 @@
     <ErrorReport>prompt</ErrorReport>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Curtain.Framework">
+    <Reference Include="Curtain.Framework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\DLL\Curtain.Framework.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.VisualBasic.PowerPacks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
@@ -89,7 +90,8 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\DLL\Utilities.dll</HintPath>
     </Reference>
-    <Reference Include="zxing">
+    <Reference Include="zxing, Version=0.15.0.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\DLL\zxing.dll</HintPath>
     </Reference>
   </ItemGroup>

+ 7 - 7
DK.Service/BarcodePrintService/BarcodePrintLogic.cs

@@ -56,7 +56,7 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
             {
                 ServiceResultEntity sre = new ServiceResultEntity();
 
-                oracleTrConn = ClsDbFactory.CreateDBTransaction(Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
+                oracleTrConn = ClsDbFactory.CreateDBTransaction(IBOSS.PRD.Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
                 oracleTrConn.Connect();
 
                 // 补打
@@ -347,7 +347,7 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
         /// <returns></returns>
         public static DataSet GetBarcodePrinter(SUserInfo sUserInfo, int printType=0)
         {
-            IDBConnection oracleConn = ClsDbFactory.CreateDBConnection(Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
+            IDBConnection oracleConn = ClsDbFactory.CreateDBConnection(IBOSS.PRD.Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
             try
             {
                 //获取系统参数管理的数据
@@ -412,7 +412,7 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
                     return sre;
                 }
 
-                oracleTrConn = ClsDbFactory.CreateDBTransaction(Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
+                oracleTrConn = ClsDbFactory.CreateDBTransaction(IBOSS.PRD.Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
                 oracleTrConn.Connect();
 
                 List<OracleParameter> parameters = new List<OracleParameter>();
@@ -477,7 +477,7 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
                     new CDASqlStrParameter("LogID", "SEQ_MST_BarCodePrintLog.nextval"),
                     new CDASqlStrParameter("GroutingDailyDetailID", "@GroutingDailyDetailID@", dataRow["GroutingDailyDetailID"]),
                     new CDASqlStrParameter("BarCode", "@BarCode@", dataRow["BarCode"]),
-                    new CDASqlStrParameter("Outlabelcode", "@Outlabelcode@", dataRow["Outlabelcode"]),
+                    new CDASqlStrParameter("Outlabelcode", "@Outlabelcode@", dataRow["OutOnlyCode"]),
                     new CDASqlStrParameter("PrintTypeID", "@PrintTypeID@", PrintTypeID),
                     new CDASqlStrParameter("PrintWay", "@PrintWay@", PrintWay),
                     new CDASqlStrParameter("PrintData", "@PrintData@", pdata),
@@ -530,14 +530,14 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
                     return sre;
                 }
 
-                oracleTrConn = ClsDbFactory.CreateDBTransaction(Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
+                oracleTrConn = ClsDbFactory.CreateDBTransaction(IBOSS.PRD.Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
                 oracleTrConn.Connect();
                 List<OracleParameter> parameters = new List<OracleParameter>();
 
                 if (printerID == null)
                 {
                     // 打印
-                    printWay = 1;
+                    //printWay = 1;
                     string sqlPrinterName =
                        "SELECT p.printername, p.printtype\n" +
                        "  FROM tp_mst_user u\n" +
@@ -662,7 +662,7 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
 
                 DataSet data = oracleTrConn.ExecStoredProcedure("PRO_PM_GETBarCodePrintDATA_3C", parameters.ToArray());
 
-                int status = Convert.ToInt32(parameters[3].Value.ToString());
+                int status = Convert.ToInt32(parameters[5].Value.ToString());
                 if (status < 0)
                 {
                     sre.Status = Constant.ServiceResultStatus.Other;

+ 4 - 18
DK.Service/BarcodePrintService/BarcodePrintService.csproj

@@ -80,25 +80,7 @@
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="BarcodePrintLogic.cs" />
-    <Compile Include="Common\LayoutCommon.cs" />
-    <Compile Include="Common\LayoutUtility.cs" />
-    <Compile Include="DataModel\LayoutConsts.cs" />
-    <Compile Include="DataModel\LayoutObjects.cs" />
-    <Compile Include="DataModel\PropertyOfLayoutBox.cs" />
-    <Compile Include="DataModel\TextRectangleF.cs" />
     <Compile Include="InvoiceLayoutPrinter.cs" />
-    <Compile Include="Items\DataGridItem\GridItem.cs" />
-    <Compile Include="Items\DataGridItem\GridItemColumn.cs" />
-    <Compile Include="Items\DataGridItem\GridItemColumnCollection.cs" />
-    <Compile Include="Items\DataGridItem\PageNumItem.cs" />
-    <Compile Include="Items\DataGridItem\TotalTextItem.cs" />
-    <Compile Include="Items\EllipseItem.cs" />
-    <Compile Include="Items\GraphicsItem.cs" />
-    <Compile Include="Items\IBoundItem.cs" />
-    <Compile Include="Items\ImageItem.cs" />
-    <Compile Include="Items\LayoutItem.cs" />
-    <Compile Include="Items\RectangleItem.cs" />
-    <Compile Include="Items\TextItem.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -143,6 +125,10 @@
       <Project>{4c4bfbdc-125c-488a-8b35-5a0637478c66}</Project>
       <Name>WCF.DataModels</Name>
     </ProjectReference>
+    <ProjectReference Include="..\InvoiceLayout\InvoiceLayout.csproj">
+      <Project>{440b03e6-474c-439a-af83-900a01a57abe}</Project>
+      <Name>InvoiceLayout</Name>
+    </ProjectReference>
     <ProjectReference Include="..\Service.DataModels\Service.DataModels.csproj">
       <Project>{16c72702-c162-4cd3-9ccc-40b9d8491ccd}</Project>
       <Name>Service.DataModels</Name>

+ 1 - 1
DK.Service/BarcodePrintService/InvoiceLayoutPrinter.cs

@@ -147,7 +147,7 @@ namespace Dongke.WinForm.Controls.InvoiceLayout
                 }
                 else
                 {
-                    //this.Property = (PropertyOfLayoutBox)formatter.Deserialize(stream);
+                    this.Property = (PropertyOfLayoutBox)formatter.Deserialize(stream);
                 }
                 //_lastItemRF = propertyOflayoutBox.LastItemRF;
                 //_newItemID = propertyOflayoutBox.NewItemID;

+ 112 - 0
DK.Service/InvoiceLayout/BarcodeDraw.cs

@@ -0,0 +1,112 @@
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Runtime.InteropServices;
+
+using Curtain.Framework.Barcode;
+using Curtain.Framework.Barcode.OneD;
+using Curtain.Framework.Barcode.QRCode;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+    public static class BarcodeDraw
+    {
+        /// <summary>
+        /// 绘制图片
+        /// </summary>
+        /// <param name="data"></param>
+        /// <param name="options"></param>
+        /// <param name="rectangle"></param>
+        /// <returns></returns>
+        public static void DrawOneDImageOnGraphics(string value, Rectangle rectangle, OneDDrawingOptions options)
+        {
+            OneDData data = OneDHelper.Encode(value, rectangle.Width, rectangle.Height, BarcodeMargin.Empty);
+
+            using (Bitmap dataImage = new Bitmap(data.Lenght, rectangle.Height, options.DrawGraphics))
+            {
+                Rectangle imageRect = new Rectangle(0, 0, dataImage.Width, dataImage.Height);
+
+                BitmapData bmpData = dataImage.LockBits(imageRect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
+                try
+                {
+                    byte[] pixels = new byte[bmpData.Stride * bmpData.Height];
+                    int index = 0;
+                    for (int x = 0; x < bmpData.Width; x++)
+                    {
+                        Color color = (data[x] ? options.ForeColor : options.BackColor);
+                        pixels[index++] = color.B;
+                        pixels[index++] = color.G;
+                        pixels[index++] = color.R;
+                        pixels[index++] = color.A;
+                    }
+                    //index += padding;
+
+                    for (int y = 1; y < bmpData.Height; y++)
+                    {
+                        Array.Copy(pixels, 0, pixels, y * bmpData.Stride, bmpData.Stride);
+                    }
+                    Marshal.Copy(pixels, 0, bmpData.Scan0, pixels.Length);
+                }
+                finally
+                {
+                    dataImage.UnlockBits(bmpData);
+                }
+
+                Rectangle rect = new Rectangle(rectangle.Left + (rectangle.Width - dataImage.Width) / 2,
+                   rectangle.Top,
+                   dataImage.Width,
+                   dataImage.Height);
+                //options.DrawGraphics.DrawImage(dataImage, rect, imageRect, GraphicsUnit.Pixel);
+                options.DrawGraphics.DrawImage(dataImage, rect.Left, rect.Top, imageRect, GraphicsUnit.Pixel);
+            }
+        }
+
+
+        /// <summary>
+        /// 绘制图片
+        /// </summary>
+        /// <param name="data"></param>
+        /// <param name="options"></param>
+        /// <param name="rectangle"></param>
+        /// <returns></returns>
+        public static void DrawQRCodeImageOnGraphics(string value, Rectangle rectangle, QRCodeDrawingOptions options)
+        {
+            QRCodeData data = QRCodeHelper.Encode(value, rectangle.Width, rectangle.Height, BarcodeMargin.Empty);
+
+            using (Bitmap dataImage = new Bitmap(data.Size, data.Size, options.DrawGraphics))
+            {
+                Rectangle imageRect = new Rectangle(0, 0, dataImage.Width, dataImage.Height);
+                BitmapData bmpData = dataImage.LockBits(imageRect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
+                try
+                {
+                    byte[] pixels = new byte[bmpData.Stride * bmpData.Height];
+                    int index = 0;
+                    for (int y = 0; y < data.Size; y++)
+                    {
+                        for (int x = 0; x < data.Size; x++)
+                        {
+                            Color color = (data[x, y] ? options.ForeColor : options.BackColor);
+                            pixels[index++] = color.B;
+                            pixels[index++] = color.G;
+                            pixels[index++] = color.R;
+                            pixels[index++] = color.A;
+                        }
+                    }
+                    Marshal.Copy(pixels, 0, bmpData.Scan0, pixels.Length);
+                }
+                finally
+                {
+                    dataImage.UnlockBits(bmpData);
+                }
+
+                Rectangle rect = new Rectangle(rectangle.Left + (rectangle.Width - dataImage.Width) / 2,
+                   rectangle.Top + (rectangle.Height - dataImage.Height) / 2,
+                   dataImage.Width,
+                   dataImage.Height);
+                //options.DrawGraphics.DrawImage(dataImage, rect, imageRect, GraphicsUnit.Pixel);
+                options.DrawGraphics.DrawImage(dataImage, rect.Left, rect.Top, imageRect, GraphicsUnit.Pixel);
+            }
+        }
+
+    }
+}

+ 542 - 0
DK.Service/InvoiceLayout/Common/LayoutCommon.cs

@@ -0,0 +1,542 @@
+using System;
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+    /// ====================================================================
+    /// 类名:LayoutUtility
+    /// <summary>
+    /// Layout共通方法
+    /// </summary>
+    /// ====================================================================
+    public static class LayoutCommon
+	{
+        #region 成员变量
+        // DPI用
+        private static float _dpi = 300;
+		//private static readonly Control _control;
+		// 图形
+		//private static readonly Graphics _graphics;
+		// 默认字体
+		//private static readonly Font _defaultItemFont;
+		// 选择画刷
+		//private static readonly SolidBrush _selectedBrush;
+		// 打印范围用绿线标识
+		//private static readonly Pen _greedDotPen;
+		// StringFormat
+		private static readonly StringFormat _stringFormatHorizontal;
+		// 文本Item的默认宽
+		//private static readonly float _defaultTextItemSizeWidth = 0f;
+		// 文本Item的默认高
+		//private static readonly float _defaultTextItemSizeHeight = 0f;
+		// JPカルチャ
+		//private static readonly CultureInfo _cultureInfoJP;
+		// 格式
+		//public static DataTable SYSFormat = new DataTable("SYSFormat");
+		// 默认值
+		//public static DataTable SYSDefaultValue = new DataTable("SYSDefaultValue");
+		#endregion 成员变量
+
+		#region 构造函数
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		static LayoutCommon()
+		{
+			//_control = new Control();
+			//_graphics = _control.CreateGraphics();
+			//_graphics.PageUnit = GraphicsUnit.Millimeter;
+
+			//_selectedBrush = new SolidBrush(Color.LightGray);
+
+			//_greedDotPen = new Pen(Color.Green, 1);
+			//_greedDotPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
+
+			//_cultureInfoJP = new CultureInfo(LayoutConsts.CULTUREINFO_JP);
+			//_cultureInfoJP.DateTimeFormat.Calendar = new JapaneseCalendar();
+
+			_stringFormatHorizontal = new StringFormat(StringFormat.GenericTypographic);
+			_stringFormatHorizontal.Alignment = StringAlignment.Center;
+			_stringFormatHorizontal.LineAlignment = StringAlignment.Center;
+			_stringFormatHorizontal.LineAlignment = StringAlignment.Near;
+			_stringFormatHorizontal.FormatFlags = StringFormatFlags.FitBlackBox
+												| StringFormatFlags.NoWrap
+												| StringFormatFlags.NoClip;
+
+			//_defaultItemFont = new Font(LayoutConsts.ITEM_FONT_FAMILYNAME_DEFAULT,
+			//							LayoutConsts.ITEM_FONT_EMSIZE_DEFAULT);
+			//float fontHeight = Convert.ToSingle(Math.Ceiling(GetMaxSizeF(_defaultItemFont).Height * 10) / 10);
+			//_defaultTextItemSizeHeight = LayoutConsts.TEXT_MARGIN + LayoutConsts.TEXT_MARGIN + fontHeight;
+			//_defaultTextItemSizeWidth = 40f;
+
+			//Stream sysFormat = System.Reflection.Assembly.GetExecutingAssembly().
+			//		GetManifestResourceStream(@"Dongke.IBOSS.Framework.InvoiceLayout.Resources.SYSFormat.xml");
+			//SYSFormat.ReadXml(sysFormat);
+
+			//Stream sysDefaultValue = System.Reflection.Assembly.GetExecutingAssembly().
+			//	GetManifestResourceStream(@"Dongke.IBOSS.Framework.InvoiceLayout.Resources.SYSDefaultValue.xml");
+			//SYSDefaultValue.ReadXml(sysDefaultValue);
+		}
+		#endregion 构造函数
+
+		#region 属性
+		///// <summary>
+		///// 获取系统DPI
+		///// </summary>
+		//public static Graphics ControlGraphics
+		//{
+		//	get
+		//	{
+		//		return _graphics;
+		//	}
+		//}
+
+		/// <summary>
+		/// 获取系统DPI
+		/// </summary>
+		public static float DPI
+		{
+			get
+			{
+				return _dpi;
+			}
+            set
+            {
+                _dpi = value;
+            }
+		}
+
+		///// <summary>
+		///// 默认字体
+		///// </summary>
+		//public static Font DefaultItemFont
+		//{
+		//	get
+		//	{
+		//		return (Font)_defaultItemFont.Clone();
+		//	}
+		//}
+
+		///// <summary>
+		///// 选择画刷
+		///// </summary>
+		//public static SolidBrush SelectedBrush
+		//{
+		//	get
+		//	{
+		//		return _selectedBrush;
+		//	}
+		//}
+
+		///// <summary>
+		///// 打印范围用绿线标识
+		///// </summary>
+		//public static Pen GreedDotPen
+		//{
+		//	get
+		//	{
+		//		return _greedDotPen;
+		//	}
+		//}
+
+		/// <summary>
+		/// StringFormat
+		/// </summary>
+		public static StringFormat StringFormatHorizontal
+		{
+			get
+			{
+				return _stringFormatHorizontal;
+			}
+		}
+
+
+		///// <summary>
+		///// 文本Item默认宽
+		///// </summary>
+		//public static float DefaultTextItemSizeWidth
+		//{
+		//	get
+		//	{
+		//		return _defaultTextItemSizeWidth;
+		//	}
+		//}
+
+		///// <summary>
+		///// 文本Item默认高
+		///// </summary>
+		//public static float DefaultTextItemSizeHeight
+		//{
+		//	get
+		//	{
+		//		return _defaultTextItemSizeHeight;
+		//	}
+		//}
+
+		//public static CultureInfo CultureInfoJP
+		//{
+		//	get
+		//	{
+		//		return _cultureInfoJP;
+		//	}
+		//}
+		#endregion 属性
+
+		#region 函数
+		/// <summary>
+		/// 1/100 英寸转换为毫米
+		/// </summary>
+		/// <remarks>
+		/// 表示倍率 100%
+		/// </remarks>
+		/// <param name="pixel">1/100 英寸</param>
+		/// <returns>毫米</returns>
+		public static float Inch100ToMillimeter(int inch100)
+		{
+			float mm = inch100 * LayoutConsts.MILLIMETER_PER_INCH / 100;
+			return mm;
+		}
+
+		/// <summary>
+		/// 1/100 英寸转换为毫米
+		/// </summary>
+		/// <remarks>
+		/// 表示倍率 100%
+		/// </remarks>
+		/// <param name="pixel">1/100 英寸</param>
+		/// <returns>毫米</returns>
+		public static float Inch100ToMillimeter(float inch100)
+		{
+			float mm = inch100 * LayoutConsts.MILLIMETER_PER_INCH / 100;
+			return mm;
+		}
+
+		/// <summary>
+		/// 磅转换为毫米
+		/// </summary>
+		/// <remarks>
+		/// 表示倍率 100%
+		/// </remarks>
+		/// <param name="point">磅</param>
+		/// <returns>毫米</returns>
+		public static float PointToMillimeter(float point)
+		{
+			float mm = point / LayoutConsts.POINT_PER_INCH * LayoutConsts.MILLIMETER_PER_INCH;
+			return mm;
+		}
+
+		/// <summary>
+		/// 磅转换为像素
+		/// </summary>
+		/// <remarks>
+		/// 表示倍率 100%
+		/// </remarks>
+		/// <param name="point">磅</param>
+		/// <returns>像素</returns>
+		public static int PointToPixel(float point)
+		{
+			decimal pixel = System.Convert.ToDecimal(point) /
+				System.Convert.ToDecimal(LayoutConsts.POINT_PER_INCH) *
+				System.Convert.ToDecimal(DPI);
+			return System.Convert.ToInt32(Math.Round(pixel, 0));
+		}
+
+		/// <summary>
+		/// 毫米转换为1/100 英寸
+		/// </summary>
+		/// <remarks>
+		/// 表示倍率 100%
+		/// </remarks>
+		/// <param name="mm">毫米</param>
+		/// <returns>1/100 英寸</returns>
+		public static int MillimeterToInch100(float mm)
+		{
+			float inch100 = mm / LayoutConsts.MILLIMETER_PER_INCH * 100;
+			return System.Convert.ToInt32(Math.Round(inch100, 0));
+		}
+
+		/// <summary>
+		/// 毫米转换为1/100 英寸
+		/// </summary>
+		/// <remarks>
+		/// 表示倍率 100%
+		/// </remarks>
+		/// <param name="mm">毫米</param>
+		/// <returns>1/100 英寸</returns>
+		public static float MillimeterToInch100Single(float mm)
+		{
+			float inch100 = mm / LayoutConsts.MILLIMETER_PER_INCH * 100;
+			return inch100;
+		}
+
+		/// <summary>
+		/// 毫米转换为像素
+		/// </summary>
+		/// <remarks>
+		/// 表示倍率 100%
+		/// </remarks>
+		/// <param name="mm">毫米</param>
+		/// <returns>像素</returns>
+		public static int MillimeterToPixel(float mm)
+		{
+			decimal pixel = System.Convert.ToDecimal(mm) /
+				System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) *
+				System.Convert.ToDecimal(DPI);
+			return System.Convert.ToInt32(Math.Round(pixel, 0));
+        }
+        public static int MillimeterToPixel(float mm, float dpi)
+        {
+            decimal pixel = System.Convert.ToDecimal(mm) /
+                System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) *
+                System.Convert.ToDecimal(dpi);
+            return System.Convert.ToInt32(Math.Round(pixel, 0));
+        }
+
+        /// <summary>
+        /// 毫米转换为像素
+        /// </summary>
+        /// <param name="mm">毫米</param>
+        /// <param name="paperZoom">表示倍率%</param>
+        /// <returns>像素</returns>
+        public static int MillimeterToPixel(float mm, int paperZoom)
+		{
+			if (0 < paperZoom)
+			{
+				decimal pixel = System.Convert.ToDecimal(mm) /
+				System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) *
+				System.Convert.ToDecimal(DPI) *
+				System.Convert.ToDecimal(paperZoom) / 100m;
+				return System.Convert.ToInt32(Math.Round(pixel, 0));
+			}
+			else
+			{
+				return 0;
+			}
+		}
+
+		/// <summary>
+		/// 毫米转换为像素
+		/// </summary>
+		/// <param name="mm">毫米</param>
+		/// <param name="paperZoom">表示倍率%</param>
+		/// <returns>像素</returns>
+		public static int MillimeterToPixel(float mm, double paperZoom)
+		{
+			if (0 < paperZoom)
+			{
+				decimal pixel = System.Convert.ToDecimal(mm) /
+				System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) *
+				System.Convert.ToDecimal(DPI) *
+				System.Convert.ToDecimal(paperZoom);
+				return System.Convert.ToInt32(Math.Round(pixel, 0));
+			}
+			else
+			{
+				return 0;
+			}
+		}
+
+		/// <summary>
+		/// 毫米转换为像素
+		/// </summary>
+		/// <param name="mm">毫米</param>
+		/// <param name="paperZoom">表示倍率%</param>
+		/// <returns>像素</returns>
+		public static float MillimeterToPixelSingle(float mm, int paperZoom)
+		{
+			if (0 < paperZoom)
+			{
+				decimal pixel = System.Convert.ToDecimal(mm) /
+				System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) *
+				System.Convert.ToDecimal(DPI) *
+				System.Convert.ToDecimal(paperZoom) / 100m;
+				return System.Convert.ToSingle(pixel);
+			}
+			else
+			{
+				return 0f;
+			}
+		}
+
+		/// <summary>
+		/// 像素转换为毫米
+		/// </summary>
+		/// <remarks>
+		/// 表示倍率 100%
+		/// </remarks>
+		/// <param name="pixel">像素</param>
+		/// <returns>毫米</returns>
+		public static float PixelToMillimeter(int pixel)
+		{
+			decimal mm = System.Convert.ToDecimal(pixel) *
+				System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) /
+				System.Convert.ToDecimal(DPI);
+			return System.Convert.ToSingle(mm);
+		}
+
+		/// <summary>
+		/// 像素转换为毫米
+		/// </summary>
+		/// <param name="pixel">像素</param>
+		/// <param name="paperZoom">表示倍率%</param>
+		/// <returns>毫米</returns>
+		public static float PixelToMillimeter(int pixel, int paperZoom)
+		{
+			if (0 < paperZoom)
+			{
+				decimal mm = System.Convert.ToDecimal(pixel) *
+					System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) /
+					System.Convert.ToDecimal(DPI) /
+					System.Convert.ToDecimal(paperZoom) * 100m;
+				return System.Convert.ToSingle(mm);
+			}
+			else
+			{
+				return 0f;
+			}
+		}
+
+		/// <summary>
+		/// 像素转换为毫米
+		/// </summary>
+		/// <param name="pixel">像素</param>
+		/// <param name="paperZoom">表示倍率%</param>
+		/// <param name="dpi">DPI</param>
+		/// <returns>毫米</returns>
+		public static float PixelToMillimeter(int pixel, int paperZoom, float dpi)
+		{
+			if (0 < paperZoom)
+			{
+				decimal mm = System.Convert.ToDecimal(pixel) *
+					System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) /
+					System.Convert.ToDecimal(dpi) /
+					System.Convert.ToDecimal(paperZoom) * 100m;
+				return System.Convert.ToSingle(mm);
+			}
+			else
+			{
+				return 0f;
+			}
+		}
+
+		/// <summary>
+		/// 像素转换为毫米
+		/// </summary>
+		/// <param name="pixel">像素</param>
+		/// <param name="paperZoom">表示倍率%</param>
+		/// <returns>毫米</returns>
+		public static float PixelToMillimeter(int pixel, double paperZoom)
+		{
+			if (0 < paperZoom)
+			{
+				decimal mm = System.Convert.ToDecimal(pixel) *
+					System.Convert.ToDecimal(LayoutConsts.MILLIMETER_PER_INCH) /
+					System.Convert.ToDecimal(DPI) /
+					System.Convert.ToDecimal(paperZoom);
+				return System.Convert.ToSingle(mm);
+			}
+			else
+			{
+				return 0f;
+			}
+		}
+
+		/// <summary>
+		/// 截断到指定的精度。
+		/// </summary>
+		/// <param name="value">截断的目标</param>
+		/// <param name="digits">精度</param>
+		/// <returns>截断后的数值</returns>
+		public static float Truncate(float value, int digits)
+		{
+			double v = Math.Pow(10, digits);
+			return Convert.ToSingle(Math.Truncate((double)value * v) / v);
+		}
+
+		/// <summary>
+		/// 截断到指定的精度。
+		/// </summary>
+		/// <param name="value">截断的目标</param>
+		/// <param name="digits">精度</param>
+		/// <returns>截断后的数值</returns>
+		public static decimal Truncate(decimal value, int digits)
+		{
+			decimal v = (decimal)Math.Pow(10, digits);
+			return Math.Truncate(value * v) / v;
+		}
+
+		///// <summary>
+		///// 全角字符尺寸
+		///// </summary>
+		///// <param name="font">字体</param>
+		///// <returns>全角字符尺寸</returns>
+		//public static SizeF GetMaxSizeF(Font font)
+		//{
+		//	return _graphics.MeasureString(LayoutConsts.FULLSHAPE_TEXT,
+		//		font, PointF.Empty, _stringFormatHorizontal);
+		//}
+
+		///// <summary>
+		///// 文字间隔计算
+		///// </summary>
+		///// <param name="width">宽</param>
+		///// <param name="charCount">文字个数</param>
+		///// <param name="font">字体</param>
+		///// <returns>文字间隔</returns>
+		//public static float EqualityChars(float width, int charCount, Font font)
+		//{
+		//	SizeF maxSizeF = GetMaxSizeF(font);
+		//	double equalityCharSpace;
+		//	if (1 < charCount)
+		//	{
+		//		equalityCharSpace =
+		//			((width
+		//			- LayoutConsts.TEXT_MARGIN
+		//			- LayoutConsts.TEXT_MARGIN
+		//			- maxSizeF.Width)
+		//			/ (charCount - 1))
+		//			- maxSizeF.Width;
+		//	}
+		//	else
+		//	{
+		//		equalityCharSpace = 0;
+		//	}
+		//	return (float)equalityCharSpace;
+		//}
+
+		///// <summary>
+		///// 文字间隔计算
+		///// </summary>
+		///// <param name="width">宽</param>
+		///// <param name="charCount">文字个数</param>
+		///// <param name="font">字体</param>
+		///// <returns>文字间隔</returns>
+		//public static decimal EqualityChars(decimal width, decimal charCount, Font font)
+		//{
+		//	SizeF sizef = GetMaxSizeF(font);
+		//	decimal equalityCharSpace;
+		//	if (1 < charCount)
+		//	{
+		//		equalityCharSpace =
+		//			((width
+		//			 - System.Convert.ToDecimal(LayoutConsts.TEXT_MARGIN + LayoutConsts.TEXT_MARGIN)
+		//			- System.Convert.ToDecimal(sizef.Width))
+		//			/ (charCount - 1))
+		//			- System.Convert.ToDecimal(sizef.Width);
+		//	}
+		//	else
+		//	{
+		//		equalityCharSpace =
+		//			(width
+		//			 - System.Convert.ToDecimal(LayoutConsts.TEXT_MARGIN + LayoutConsts.TEXT_MARGIN)
+		//			- System.Convert.ToDecimal(sizef.Width));
+		//	}
+		//	if (equalityCharSpace < 0)
+		//	{
+		//		equalityCharSpace = 0;
+		//	}
+		//	return equalityCharSpace;
+		//}
+		#endregion 函数
+	}
+}

+ 1225 - 0
DK.Service/InvoiceLayout/Common/LayoutUtility.cs

@@ -0,0 +1,1225 @@
+//#define DRAWTEST
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:LayoutUtility.cs
+ *		2.功能描述:Layout工具类
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/11				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+//using Microsoft.VisualBasic.PowerPacks;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	public static class LayoutUtility
+	{
+		#region 函数
+		///// <summary>
+		///// 获取图形实例
+		///// </summary>
+		///// <param name="item"></param>
+		///// <returns></returns>
+		//public static Shape GetNewShape(LayoutItem item)
+		//{
+		//	Shape shape = null;
+		//	switch (item.ItemType)
+		//	{
+		//		case ItemType.Ellipse:
+		//			OvalShape eShape = new OvalShape();
+		//			eShape.SelectionColor = Color.Transparent;
+		//			eShape.BorderStyle = DashStyle.Solid;
+		//			eShape.BorderColor = Color.Black;
+		//			shape = eShape;
+		//			break;
+		//		case ItemType.Rectangle:
+		//			RectangleShape rShape = new RectangleShape();
+		//			rShape.SelectionColor = Color.Transparent;
+		//			rShape.BorderStyle = DashStyle.Solid;
+		//			rShape.BorderColor = Color.Black;
+		//			shape = rShape;
+		//			break;
+		//		case ItemType.Image:
+		//		case ItemType.Text:
+		//		case ItemType.Grid:
+		//		case ItemType.PageNum:
+		//		default:
+		//			RectangleShape dShape = new RectangleShape();
+		//			dShape.SelectionColor = Color.Transparent;
+		//			dShape.BorderStyle = DashStyle.Custom;
+		//			dShape.BorderColor = Color.Transparent;
+		//			shape = dShape;
+		//			break;
+		//	}
+		//	return shape;
+		//}
+
+		#region 绘制直线
+		/// <summary>
+		/// 绘制直线
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="startPoint">起点</param>
+		/// <param name="endPoint">终点</param>
+		/// <param name="lineColor">线的颜色</param>
+		/// <param name="lineWidth">线宽(mm)</param>
+		public static void DrawLine(
+					Graphics graphics,
+					PointF startPoint,
+					PointF endPoint,
+					Color lineColor,
+					float lineWidth)
+		{
+			DrawLine(graphics, graphics.PageUnit, startPoint, endPoint, lineColor, lineWidth);
+		}
+
+		/// <summary>
+		/// 绘制直线
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="unit">GraphicsUnit</param>
+		/// <param name="startPoint">起点</param>
+		/// <param name="endPoint">终点</param>
+		/// <param name="lineColor">线的颜色</param>
+		/// <param name="lineWidth">线宽(mm)</param>
+		public static void DrawLine(
+					Graphics graphics,
+					GraphicsUnit unit,
+					PointF startPoint,
+					PointF endPoint,
+					Color lineColor,
+					float lineWidth)
+		{
+			if (lineWidth == 0 || ((startPoint.X == endPoint.X) && (startPoint.Y == endPoint.Y)))
+			{
+				return;
+			}
+			GraphicsContainer containerState = graphics.BeginContainer();
+			graphics.PageUnit = unit;
+
+			SmoothingMode smoothingMode = graphics.SmoothingMode;
+			try
+			{
+				using (Pen pen = new Pen(lineColor))
+				{
+					graphics.SmoothingMode = SmoothingMode.AntiAlias;
+					pen.Width = Math.Max(LayoutCommon.PixelToMillimeter(1), lineWidth);
+					graphics.DrawLine(pen, startPoint, endPoint);
+				}
+			}
+			finally
+			{
+				graphics.SmoothingMode = smoothingMode;
+				graphics.EndContainer(containerState);
+			}
+		}
+		#endregion 绘制直线
+
+		#region 绘制椭圆
+		/// <summary>
+		/// 绘制椭圆
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="rectangle">图形范围</param>
+		/// <param name="lineColor">边线颜色</param>
+		/// <param name="fillColor">填充颜色</param>
+		/// <param name="lineWidth">边线宽(mm)</param>
+		/// <param name="isTransparent">背景是否透明</param>
+		public static void DrawEllipse(
+					Graphics graphics,
+					RectangleF rectangle,
+					Color lineColor,
+					Color fillColor,
+					float lineWidth,
+					bool isTransparent)
+		{
+			DrawEllipse(graphics, graphics.PageUnit, rectangle,
+				lineColor, fillColor, lineWidth, isTransparent);
+		}
+
+		/// <summary>
+		/// 绘制椭圆
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="unit">GraphicsUnit</param>
+		/// <param name="rectangle">图形范围</param>
+		/// <param name="lineColor">边线颜色</param>
+		/// <param name="fillColor">填充颜色</param>
+		/// <param name="lineWidth">边线宽(mm)</param>
+		/// <param name="isTransparent">背景是否透明</param>
+		public static void DrawEllipse(
+					Graphics graphics,
+					GraphicsUnit unit,
+					RectangleF rectangle,
+					Color lineColor,
+					Color fillColor,
+					float lineWidth,
+					bool isTransparent)
+		{
+			if ((rectangle.Width < 0) || (rectangle.Height < 0))
+			{
+				return;
+			}
+			GraphicsContainer containerState = graphics.BeginContainer();
+			graphics.PageUnit = unit;
+
+			SmoothingMode smoothingMode = graphics.SmoothingMode;
+			try
+			{
+				if (!isTransparent && (rectangle.Width > 0) && (rectangle.Height > 0))
+				{
+					graphics.SmoothingMode = SmoothingMode.Default;
+					using (Brush brush = new SolidBrush(fillColor))
+					{
+						graphics.FillEllipse(brush, rectangle);
+					}
+				}
+				if (lineWidth != 0)
+				{
+					float minWidth = LayoutCommon.PixelToMillimeter(1);
+					using (Pen pen = new Pen(lineColor))
+					{
+						if ((rectangle.Width > 0) && (rectangle.Height == 0))
+						{
+							pen.Width = minWidth;
+							graphics.SmoothingMode = SmoothingMode.AntiAlias;
+							graphics.DrawLine(pen, rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Top);
+						}
+						else if ((rectangle.Width == 0) && (rectangle.Height > 0))
+						{
+							pen.Width = minWidth;
+							graphics.SmoothingMode = SmoothingMode.AntiAlias;
+							graphics.DrawLine(pen, rectangle.Left, rectangle.Top, rectangle.Left, rectangle.Bottom);
+						}
+						else
+						{
+							float num = Math.Min(rectangle.Width, rectangle.Height) / 2;
+							num = Math.Min(num, lineWidth);
+							pen.Width = Math.Max(minWidth, num);
+							graphics.SmoothingMode = SmoothingMode.Default;
+							graphics.DrawEllipse(pen, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height);
+						}
+					}
+				}
+			}
+			finally
+			{
+				graphics.SmoothingMode = smoothingMode;
+				graphics.EndContainer(containerState);
+			}
+		}
+		#endregion 绘制椭圆
+
+		#region 绘制矩形
+		/// <summary>
+		/// 绘制矩形
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="unit">GraphicsUnit</param>
+		/// <param name="rectangle">图形范围</param>
+		/// <param name="lineColor">边线颜色</param>
+		/// <param name="fillColor">填充颜色</param>
+		/// <param name="lineWidth">边线宽(mm)</param>
+		/// <param name="isTransparent">背景是否透明</param>
+		public static void DrawRectangle(
+					Graphics graphics,
+					RectangleF rectangle,
+					Color lineColor,
+					Color fillColor,
+					float lineWidth,
+					bool isTransparent)
+		{
+			DrawRectangle(graphics, graphics.PageUnit, rectangle,
+				lineColor, fillColor, lineWidth, isTransparent);
+		}
+
+		/// <summary>
+		/// 绘制矩形
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="unit">GraphicsUnit</param>
+		/// <param name="rectangle">图形范围</param>
+		/// <param name="lineColor">边线颜色</param>
+		/// <param name="fillColor">填充颜色</param>
+		/// <param name="lineWidth">边线宽(mm)</param>
+		/// <param name="isTransparent">背景是否透明</param>
+		public static void DrawRectangle(
+					Graphics graphics,
+					GraphicsUnit unit,
+					RectangleF rectangle,
+					Color lineColor,
+					Color fillColor,
+					float lineWidth,
+					bool isTransparent)
+		{
+			if ((rectangle.Width < 0) || (rectangle.Height < 0))
+			{
+				return;
+			}
+			GraphicsContainer containerState = graphics.BeginContainer();
+			graphics.PageUnit = unit;
+
+			SmoothingMode smoothingMode = graphics.SmoothingMode;
+			try
+			{
+				if (!isTransparent && (rectangle.Width > 0) && (rectangle.Height > 0))
+				{
+					graphics.SmoothingMode = SmoothingMode.Default;
+					using (Brush brush = new SolidBrush(fillColor))
+					{
+						graphics.FillRectangle(brush, rectangle);
+					}
+				}
+				if (lineWidth != 0)
+				{
+					float minWidth = LayoutCommon.PixelToMillimeter(1);
+					using (Pen pen = new Pen(lineColor))
+					{
+						if ((rectangle.Width > 0) && (rectangle.Height == 0))
+						{
+							pen.Width = minWidth;
+							graphics.SmoothingMode = SmoothingMode.AntiAlias;
+							graphics.DrawLine(pen, rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Top);
+						}
+						else if ((rectangle.Width == 0) && (rectangle.Height > 0))
+						{
+							pen.Width = minWidth;
+							graphics.SmoothingMode = SmoothingMode.AntiAlias;
+							graphics.DrawLine(pen, rectangle.Left, rectangle.Top, rectangle.Left, rectangle.Bottom);
+						}
+						else
+						{
+							float num = Math.Min(rectangle.Width, rectangle.Height) / 2;
+							num = Math.Min(num, lineWidth);
+							pen.Width = Math.Max(minWidth, num);
+							graphics.SmoothingMode = SmoothingMode.Default;
+							graphics.DrawRectangle(pen, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height);
+						}
+					}
+				}
+			}
+			finally
+			{
+				graphics.SmoothingMode = smoothingMode;
+				graphics.EndContainer(containerState);
+			}
+		}
+		#endregion 绘制矩形
+
+		#region 绘制图片
+		/// <summary>
+		/// 绘制图片
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="rectangle">图片范围</param>
+		/// <param name="image">图片</param>
+		public static void DrawImage(
+					Graphics graphics,
+					RectangleF rectangle,
+					Image image)
+		{
+			DrawImage(graphics, graphics.PageUnit, rectangle, image);
+		}
+
+		/// <summary>
+		/// 绘制图片
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="unit">GraphicsUnit</param>
+		/// <param name="rectangle">图片范围</param>
+		/// <param name="image">图片</param>
+		public static void DrawImage(
+					Graphics graphics,
+					GraphicsUnit unit,
+					RectangleF rectangle,
+					Image image)
+		{
+			if (image == null || (rectangle.Width < 0) || (rectangle.Height < 0))
+			{
+				return;
+			}
+			GraphicsContainer containerState = graphics.BeginContainer();
+			graphics.PageUnit = unit;
+
+			graphics.DrawImage(image, rectangle);
+
+			graphics.EndContainer(containerState);
+		}
+		#endregion 绘制图片
+
+		#region 绘制文本
+		/// <summary>
+		/// 绘制文本
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="rectangleM">绘制范围(余白)</param>
+		/// <param name="rectangle">绘制范围</param>
+		/// <param name="context">文本</param>
+		/// <param name="font">字体</param>
+		/// <param name="foreColor">字体颜色</param>
+		/// <param name="lineSpace">行间隔</param>
+		/// <param name="characterSpace">字间隔</param>
+		/// <param name="charCount">行文字数</param>
+		/// <param name="alignment">文本对齐方式</param>
+		/// <param name="alignmentVertical">文本垂直对齐方式</param>
+		/// <param name="wrap">是否自动文本换行</param>
+		/// <param name="clip">是否剪裁延伸到边框外侧的文本</param>
+		/// <param name="selected">是否选择</param>
+		public static void DrawText(
+					Graphics graphics,
+					RectangleF rectangleM,
+					RectangleF rectangle,
+					string context,
+					Font font,
+					Color foreColor,
+					float lineSpace,
+					float charSpace,
+					int charCount,
+					TextAlignment alignment,
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 begin
+					TextAlignment alignmentVertical,
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 end
+					bool wrap,
+					bool clip,
+					bool selected)
+		{
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 begin
+			//DrawText(graphics, graphics.PageUnit, rectangleM, rectangle, context, font, foreColor,
+			//    lineSpace, charSpace, charCount, alignment, wrap, clip, selected);
+
+			DrawText(graphics, graphics.PageUnit, rectangleM, rectangle, context, font, foreColor,
+					lineSpace, charSpace, charCount, alignment, alignmentVertical, wrap, clip, selected);
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 end
+		}
+
+		/// <summary>
+		/// 绘制文本
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="unit">GraphicsUnit</param>
+		/// <param name="rectangleM">绘制范围(余白)</param>
+		/// <param name="rectangle">绘制范围</param>
+		/// <param name="context">文本</param>
+		/// <param name="font">字体</param>
+		/// <param name="foreColor">字体颜色</param>
+		/// <param name="lineSpace">行间隔</param>
+		/// <param name="characterSpace">字间隔</param>
+		/// <param name="charCount">行文字数</param>
+		/// <param name="alignment">文本对齐方式</param>
+		/// <param name="alignmentVertical">文本垂直对齐方式</param>
+		/// <param name="wrap">是否自动文本换行</param>
+		/// <param name="clip">是否剪裁延伸到边框外侧的文本</param>
+		/// <param name="selected">是否选择</param>
+		public static void DrawText(
+					Graphics graphics,
+					GraphicsUnit unit,
+					RectangleF rectangleM,
+					RectangleF rectangle,
+					string context,
+					Font font,
+					Color foreColor,
+					float lineSpace,
+					float charSpace,
+					int charCount,
+					TextAlignment alignment,
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 begin
+					TextAlignment alignmentVertical,
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 end
+					bool wrap,
+					bool clip,
+					bool selected)
+		{
+			clip = false;
+			selected = false;
+
+			if (string.IsNullOrEmpty(context)
+				|| rectangle.Width <= 0
+				|| rectangle.Height <= 0)
+			{
+				return;
+			}
+
+			GraphicsContainer containerState = graphics.BeginContainer();
+			graphics.PageUnit = unit;
+			graphics.SetClip(rectangleM, CombineMode.Intersect);
+
+			string[] lines = System.Text.RegularExpressions.Regex
+				.Split(context, System.Environment.NewLine);
+			using (SolidBrush textBrush = new SolidBrush(foreColor))
+			{
+#if DRAWTEST
+				graphics.DrawRectangle(new Pen(Color.Red, 0.1f), rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+#endif
+
+				// 文本垂直对齐方式 modify by chenxy 2014-03-28 begin
+				//DrawString(graphics, lines, font, textBrush, lineSpace, charSpace,
+				//    charCount, rectangle, alignment, wrap, clip, selected);
+				DrawString(graphics, lines, font, textBrush, lineSpace, charSpace,
+					charCount, rectangle, alignment, alignmentVertical, wrap, clip, selected);
+				// 文本垂直对齐方式 modify by chenxy 2014-03-28 end
+			}
+
+			graphics.EndContainer(containerState);
+		}
+
+		/// <summary>
+		/// 横向绘制文本
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="lines">多行文本</param>
+		/// <param name="font">字体</param>
+		/// <param name="textBrush">字体笔刷</param>
+		/// <param name="lineSpace">行间隔</param>
+		/// <param name="characterSpace">字间隔</param>
+		/// <param name="charCount">行文字数</param>
+		/// <param name="rectangle">文本范围</param>
+		/// <param name="alignment">文本对齐方式</param>
+		/// <param name="wrap">是否自动文本换行</param>
+		/// <param name="clip">是否剪裁延伸到边框外侧的文本</param>
+		/// <param name="selected">是否选择</param>
+		private static void DrawString(
+					Graphics graphics,
+					string[] lines,
+					Font font,
+					SolidBrush textBrush,
+					float lineSpace,
+					float charSpace,
+					int charCount,
+					RectangleF rectangle,
+					TextAlignment alignment,
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 begin
+					TextAlignment alignmentVertical,
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 end
+					bool wrap,
+					bool clip,
+					bool selected)
+		{
+			SizeF fullSizeF = graphics.MeasureString(LayoutConsts.FULLSHAPE_TEXT,
+													font,
+													PointF.Empty,
+													LayoutCommon.StringFormatHorizontal);
+			// 单行文字数限制。
+			if (0 < charCount)
+			{
+				System.Text.StringBuilder sbLine = new System.Text.StringBuilder();
+				List<string> newLines = new List<string>();
+				foreach (string line in lines)
+				{
+					char[] chars = line.ToCharArray();
+					int index = 0;
+					while (index < chars.Length)
+					{
+						int nextIndex = index + charCount;
+						if (nextIndex <= chars.Length)
+						{
+							for (int i = index; i < nextIndex; i++)
+							{
+								sbLine.Append(chars[i]);
+							}
+						}
+						else
+						{
+							for (int i = index; i < chars.Length; i++)
+							{
+								sbLine.Append(chars[i]);
+							}
+						}
+						newLines.Add(sbLine.ToString());
+						sbLine.Length = 0;
+						index = nextIndex;
+					}
+				}
+				lines = newLines.ToArray();
+				if (charCount == 1)
+				{
+					alignment = TextAlignment.Evenness;
+				}
+				else
+				{
+					alignment = TextAlignment.LeftOrTop;
+					charSpace = (rectangle.Width - fullSizeF.Width * charCount)
+									/ (charCount - 1);
+				}
+			}
+
+			SizeF halfSizeF = graphics.MeasureString(LayoutConsts.HALFSHAPE_TEXT,
+													font,
+													PointF.Empty,
+													LayoutCommon.StringFormatHorizontal);
+			// 单行文字绘制开始
+			bool isRowStart = false;
+			// 单行文字绘制结束
+			bool isRowEnd = false;
+			// 一行文字绘制开始
+			//bool isLineStart = true;
+			// 一行文字绘制结束
+			bool isLineEnd = false;
+			// 多行文字绘制开始
+			bool isLinesStart = true;
+			// 多行文字绘制结束
+			bool isLinesEnd = false;
+			// 文字整体(字间隔,行间隔)范围
+			float pointerTop = rectangle.Top;
+			float pointerBottom = rectangle.Top + fullSizeF.Height;
+			float pointerLeft = rectangle.Left;
+			// 文字范围
+			float textTop = rectangle.Top;
+			float textLeft = rectangle.Left;
+			//// 选择状态行间隔范围
+			//RectangleF lineSpaceSelectedRectangleF = RectangleF.Empty;
+			// 文字范围
+			List<TextRectangleF> textRectangleFs = new List<TextRectangleF>();
+
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 begin
+			List<TextRectangleF[]> allTextRectFs = new List<TextRectangleF[]>();
+			// 文本垂直对齐方式 modify by chenxy 2014-03-28 end
+
+			// 文本绘制
+			for (int lineIndex = 0; lineIndex < lines.Length; lineIndex++)
+			{
+				// 一行文本绘制
+				//isLineStart = true;
+				isLineEnd = false;
+				int colIndex = 0;
+				int lineCharCount = lines[lineIndex].Length;
+				char[] chars = lines[lineIndex].ToCharArray();
+				while (true)
+				{
+					isRowStart = true;
+					isRowEnd = false;
+					textLeft = rectangle.Left;
+					pointerLeft = rectangle.Left;
+					if (colIndex < lineCharCount)
+					{
+						// 单行文字绘制
+						for (int charIndex = colIndex; charIndex < lineCharCount; charIndex++, colIndex++)
+						{
+							SizeF nextTeatSizeF;
+							TextRectangleF nextTextRectangleF = new TextRectangleF();
+							nextTextRectangleF.Text = chars[charIndex].ToString();
+
+							// 单行文字数限制
+							if (0 < charCount)
+							{
+								nextTeatSizeF = fullSizeF;
+							}
+							else
+							{
+								// 半角空格的时候
+								if (LayoutConsts.SPACE_HALFSHAPE_CHAR.Equals(chars[charIndex]))
+								{
+									nextTeatSizeF = halfSizeF;
+									nextTeatSizeF.Height = fullSizeF.Height;
+								}
+								// 全角空格的时候
+								else if (LayoutConsts.SPACE_FULLSHAPE_CHAR.Equals(chars[charIndex]))
+								{
+									nextTeatSizeF = fullSizeF;
+								}
+								// 其他
+								else
+								{
+									nextTeatSizeF = graphics.MeasureString(nextTextRectangleF.Text,
+										font, PointF.Empty, LayoutCommon.StringFormatHorizontal);
+									nextTeatSizeF.Height = fullSizeF.Height;
+								}
+							}
+
+							if (isRowStart)
+							{
+								float bottom = textTop;
+								if (!isLinesStart)
+								{
+									bottom += lineSpace;
+								}
+								// 剪裁
+								if (clip)
+								{
+									bottom += nextTeatSizeF.Height;
+								}
+								// 多行绘制结束
+								if (rectangle.Bottom < bottom)
+								{
+									isLinesEnd = true;
+									break;
+								}
+
+								//// 选择状态行间隔范围填充
+								//if (selected
+								//    && 0 < lineSpace
+								//    && lineSpaceSelectedRectangleF != RectangleF.Empty)
+								//{
+								//    lineSpaceSelectedRectangleF.Height = lineSpace;
+								//    graphics.FillRectangle(LayoutCommon.SelectedBrush, lineSpaceSelectedRectangleF);
+								//    lineSpaceSelectedRectangleF = RectangleF.Empty;
+								//}
+
+								if (0 == charCount)
+								{
+									// 自动换行
+									float right = textLeft;
+									if (rectangle.Right < right)
+									{
+										if (wrap)
+										{
+											// 单行结束
+											isRowEnd = true;
+											break;
+										}
+										else
+										{
+											if (clip)
+											{
+												// 一行结束
+												isLineEnd = true;
+												break;
+											}
+										}
+									}
+								}
+							}
+							else
+							{
+								if (0 == charCount)
+								{
+									float right = textLeft + charSpace + nextTeatSizeF.Width;
+									// 自动换行
+									if (wrap)
+									{
+										if (rectangle.Right < right)
+										{
+											// 文本对齐方式
+											float correcting = 0;
+											if (alignment == TextAlignment.RightOrBottom)
+											{
+												correcting = rectangle.Right - textLeft;
+												if (0 < correcting)
+												{
+													foreach (TextRectangleF rf in textRectangleFs)
+													{
+														rf.RectangleX = rf.RectangleF.X + correcting;
+													}
+												}
+											}
+											else if (alignment == TextAlignment.Center)
+											{
+												correcting = (rectangle.Right - textLeft) / 2;
+												if (0 < correcting)
+												{
+													foreach (TextRectangleF rf in textRectangleFs)
+													{
+														rf.RectangleX = rf.RectangleF.X + correcting;
+													}
+												}
+											}
+											else if (alignment == TextAlignment.Evenness)
+											{
+												if (1 < textRectangleFs.Count)
+												{
+													correcting = (rectangle.Right - textLeft)
+																/ (textRectangleFs.Count - 1);
+													if (0 < correcting)
+													{
+														for (int j = 0; j < textRectangleFs.Count; j++)
+														{
+															textRectangleFs[j].RectangleX +=
+																correcting * j;
+														}
+													}
+												}
+												else
+												{
+													textRectangleFs[0].RectangleX +=
+														(rectangle.Right - textLeft) / 2;
+												}
+											}
+											// 单行结束
+											isRowEnd = true;
+											break;
+										}
+									}
+									else if (alignment == TextAlignment.LeftOrTop || alignment == TextAlignment.Evenness)
+									{
+										if (clip)
+										{
+											if (rectangle.Right < right)
+											{
+												// 一行结束
+												isLineEnd = true;
+												break;
+											}
+										}
+										else
+										{
+											if (rectangle.Right < textLeft + charSpace)
+											{
+												// 一行结束
+												isLineEnd = true;
+												break;
+											}
+										}
+									}
+								}
+							}
+							nextTextRectangleF.RectangleF = new RectangleF(pointerLeft, pointerTop,
+								nextTeatSizeF.Width, nextTeatSizeF.Height);
+							textRectangleFs.Add(nextTextRectangleF);
+							// 一行绘制结束
+							if (isLineEnd)
+							{
+								break;
+							}
+							// 下一个文字位置计算
+							if (isRowStart)
+							{
+								textLeft = textLeft + nextTeatSizeF.Width;
+								isRowStart = false;
+							}
+							else
+							{
+								textLeft = textLeft + charSpace + nextTeatSizeF.Width;
+							}
+							pointerLeft = pointerLeft + nextTeatSizeF.Width + charSpace;
+						}
+						// 多行绘制结束
+						if (isLinesEnd)
+						{
+							break;
+						}
+						// 一行绘制结束
+						if (isLineEnd)
+						{
+							break;
+						}
+						// 单行绘制结束
+						if (isRowEnd)
+						{
+							if (isLinesStart)
+							{
+								textTop = textTop + fullSizeF.Height;
+								isLinesStart = false;
+							}
+							else
+							{
+								textTop = textTop + lineSpace + fullSizeF.Height;
+							}
+							pointerTop = pointerTop + fullSizeF.Height + lineSpace;
+							pointerBottom = pointerTop + fullSizeF.Height;
+							// 单行文字绘制
+							if (textRectangleFs.Count > 0)
+							{
+								//lineSpaceSelectedRectangleF = DrawStringRow(graphics, textRectangleFs, font, textBrush, selected);
+								TextRectangleF[] trfs = new TextRectangleF[textRectangleFs.Count];
+								for (int i = 0; i < textRectangleFs.Count; i++)
+								{
+									trfs[i] = textRectangleFs[i];
+								}
+								textRectangleFs.Clear();
+								allTextRectFs.Add(trfs);
+							}
+						}
+					}
+					else
+					{
+						// 空白行
+						if (0 == lineCharCount)
+						{
+							float bottom = textTop;
+							if (!isLinesStart)
+							{
+								bottom += lineSpace;
+							}
+							// 剪裁
+							if (clip)
+							{
+								bottom += fullSizeF.Height;
+							}
+							// 多行绘制结束
+							if (rectangle.Bottom < bottom)
+							{
+								isLinesEnd = true;
+								break;
+							}
+
+							//// 选择状态行间隔范围填充
+							//if (selected && 0 < lineSpace && lineSpaceSelectedRectangleF != RectangleF.Empty)
+							//{
+							//    lineSpaceSelectedRectangleF.Height = lineSpace;
+							//    graphics.FillRectangle(LayoutCommon.SelectedBrush,
+							//        lineSpaceSelectedRectangleF);
+							//    lineSpaceSelectedRectangleF = RectangleF.Empty;
+							//}
+
+							//// 选择状态文本背景绘制
+							//if (selected)
+							//{
+							//    float correcting = 0;
+							//    if (alignment == TextAlignment.RightOrBottom)
+							//    {
+							//        correcting = rectangle.Right - textLeft;
+							//    }
+							//    else if (alignment == TextAlignment.Center)
+							//    {
+							//        correcting = (rectangle.Right - textLeft) / 2;
+							//    }
+							//    else if (alignment == TextAlignment.Evenness)
+							//    {
+							//        correcting = (rectangle.Right - textLeft) / 2;
+							//    }
+							//    RectangleF textRectangleF =
+							//        new RectangleF(pointerLeft + correcting,
+							//                        pointerTop,
+							//                        fullSizeF.Width / 4,
+							//                        fullSizeF.Height + lineSpace);
+							//    graphics.FillRectangle(LayoutCommon.SelectedBrush, textRectangleF);
+							//}
+						}
+						// 一行结束
+						isLineEnd = true;
+						break;
+					}
+				}
+				// 多行绘制结束
+				if (isLinesEnd)
+				{
+					break;
+				}
+				// 一行绘制结束
+				if (isLineEnd)
+				{
+					// 下一个文字位置计算
+					if (isLinesStart)
+					{
+						textTop = textTop + fullSizeF.Height;
+						isLinesStart = false;
+					}
+					else
+					{
+						textTop = textTop + lineSpace + fullSizeF.Height;
+					}
+					pointerTop = pointerTop + fullSizeF.Height + lineSpace;
+					pointerBottom = pointerTop + fullSizeF.Height;
+					// 一行文本绘制
+					//lineSpaceSelectedRectangleF = DrawLineHorizontal(graphics, textRectangleFs,
+					//    font, underline, strikeout, textBrush, rectangle, alignment, selected);
+					if (textRectangleFs.Count > 0)
+					{
+						SetStringAlignmentH(textRectangleFs, rectangle, alignment, wrap, clip);
+						//lineSpaceSelectedRectangleF = DrawStringRow(graphics, textRectangleFs, font, textBrush, selected);
+						TextRectangleF[] trfs = new TextRectangleF[textRectangleFs.Count];
+						for (int i = 0; i < textRectangleFs.Count; i++)
+						{
+							trfs[i] = textRectangleFs[i];
+						}
+						textRectangleFs.Clear();
+						allTextRectFs.Add(trfs);
+					}
+				}
+			}
+			// 文本绘制结束
+			if (isLinesEnd)
+			{
+				//if (selected && isLinesStart && isLinesEnd)
+				//{
+				//    // 选择状态空文本背景绘制
+				//    graphics.FillRectangle(LayoutCommon.SelectedBrush, rectangle);
+				//}
+				if (textRectangleFs.Count > 0)
+				{
+					SetStringAlignmentH(textRectangleFs, rectangle, alignment, wrap, clip);
+					//DrawStringRow(graphics, textRectangleFs, font, textBrush, selected);
+					TextRectangleF[] trfs = new TextRectangleF[textRectangleFs.Count];
+					for (int i = 0; i < textRectangleFs.Count; i++)
+					{
+						trfs[i] = textRectangleFs[i];
+					}
+					textRectangleFs.Clear();
+					allTextRectFs.Add(trfs);
+				}
+			}
+
+			// 垂直方向文本位置设定
+			float correctingV = 0;
+			if (alignmentVertical == TextAlignment.RightOrBottom)
+			{
+				float bottom = allTextRectFs[allTextRectFs.Count - 1][0].RectangleF.Bottom;
+				correctingV = rectangle.Bottom - bottom;
+				if (correctingV < 0)
+				{
+					correctingV = 0;
+				}
+				foreach (TextRectangleF[] rfs in allTextRectFs)
+				{
+					foreach (TextRectangleF rf in rfs)
+					{
+						rf.RectangleY = rf.RectangleY + correctingV;
+
+						graphics.DrawString(rf.Text, font, textBrush, rf.RectangleF,
+							LayoutCommon.StringFormatHorizontal);
+					}
+				}
+			}
+			else if (alignmentVertical == TextAlignment.Center)
+			{
+				float bottom = allTextRectFs[allTextRectFs.Count - 1][0].RectangleF.Bottom;
+				correctingV = (rectangle.Bottom - bottom) / 2;
+				if (correctingV < 0)
+				{
+					correctingV = 0;
+				}
+				foreach (TextRectangleF[] rfs in allTextRectFs)
+				{
+					foreach (TextRectangleF rf in rfs)
+					{
+						rf.RectangleY = rf.RectangleY + correctingV;
+
+						graphics.DrawString(rf.Text, font, textBrush, rf.RectangleF,
+							LayoutCommon.StringFormatHorizontal);
+					}
+				}
+			}
+			else
+			{
+				foreach (TextRectangleF[] rfs in allTextRectFs)
+				{
+					foreach (TextRectangleF rf in rfs)
+					{
+						graphics.DrawString(rf.Text, font, textBrush, rf.RectangleF,
+							LayoutCommon.StringFormatHorizontal);
+					}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 根据横向文本对齐方式,设定文本位子
+		/// </summary>
+		/// <param name="textRectangleFs">每个文字的范围</param>
+		/// <param name="rectangleF">文本范围</param>
+		/// <param name="alignment">文本对齐方式</param>
+		/// <param name="wrap">是否自动文本换行</param>
+		/// <param name="clip">是否剪裁延伸到边框外侧的文本</param>
+		private static void SetStringAlignmentH(
+					List<TextRectangleF> textRectangleFs,
+					RectangleF rectangleF,
+					TextAlignment alignment,
+					bool wrap,
+					bool clip)
+		{
+			//if (0 < textRectangleFs.Count)
+			{
+				float correcting = 0;
+				float right = textRectangleFs[textRectangleFs.Count - 1].RectangleF.Right;
+				// 文本对齐方式
+				if (alignment == TextAlignment.RightOrBottom)
+				{
+					correcting = rectangleF.Right - right;
+					if (wrap)
+					{
+						if (0 < correcting)
+						{
+							foreach (TextRectangleF rf in textRectangleFs)
+							{
+								rf.RectangleX += correcting;
+							}
+						}
+					}
+					// 不自动换行
+					else
+					{
+						// 剪裁
+						if (clip)
+						{
+							int count = 0;
+							foreach (TextRectangleF rf in textRectangleFs)
+							{
+								rf.RectangleX += correcting;
+								if (rf.RectangleX < rectangleF.Left)
+								{
+									count++;
+								}
+							}
+							if (count > 0)
+							{
+								textRectangleFs.RemoveRange(0, count);
+							}
+						}
+						// 不剪裁
+						else
+						{
+							int count = 0;
+							foreach (TextRectangleF rf in textRectangleFs)
+							{
+								rf.RectangleX += correcting;
+								if (rf.RectangleF.Right < rectangleF.Left)
+								{
+									count++;
+								}
+							}
+							if (count > 0)
+							{
+								textRectangleFs.RemoveRange(0, count);
+							}
+						}
+					}
+				}
+				else if (alignment == TextAlignment.Center)
+				{
+					correcting = (rectangleF.Right - right) / 2;
+					if (wrap)
+					{
+						if (0 < correcting)
+						{
+							foreach (TextRectangleF rf in textRectangleFs)
+							{
+								rf.RectangleX += correcting;
+							}
+						}
+					}
+					// 不自动换行
+					else
+					{
+						// 剪裁
+						if (clip)
+						{
+							int index = -1;
+							int count = 0;
+							int start = -1;
+							int length = 0;
+							foreach (TextRectangleF rf in textRectangleFs)
+							{
+								index++;
+								rf.RectangleX += correcting;
+								if (rf.RectangleX < rectangleF.Left)
+								{
+									count++;
+								}
+								else if (rectangleF.Right < rf.RectangleF.Right)
+								{
+									if (start < 0)
+									{
+										start = index;
+									}
+									length++;
+								}
+							}
+							if (length > 0)
+							{
+								textRectangleFs.RemoveRange(start, length);
+							}
+							if (count > 0)
+							{
+								textRectangleFs.RemoveRange(0, count);
+							}
+						}
+						else
+						{
+							int index = -1;
+							int count = 0;
+							int start = -1;
+							int length = 0;
+							foreach (TextRectangleF rf in textRectangleFs)
+							{
+								index++;
+								rf.RectangleX += correcting;
+								if (rf.RectangleF.Right < rectangleF.Left)
+								{
+									count++;
+								}
+								else if (rectangleF.Right < rf.RectangleX)
+								{
+									if (start < 0)
+									{
+										start = index;
+									}
+									length++;
+								}
+							}
+							if (length > 0)
+							{
+								textRectangleFs.RemoveRange(start, length);
+							}
+							if (count > 0)
+							{
+								textRectangleFs.RemoveRange(0, count);
+							}
+						}
+					}
+				}
+				else if (alignment == TextAlignment.Evenness)
+				{
+					if (1 < textRectangleFs.Count)
+					{
+						correcting = (rectangleF.Right - right) / (textRectangleFs.Count - 1);
+						if (correcting > 0)
+						{
+							for (int i = 0; i < textRectangleFs.Count; i++)
+							{
+								textRectangleFs[i].RectangleX += correcting * i;
+							}
+						}
+					}
+					else
+					{
+						textRectangleFs[0].RectangleX += (rectangleF.Right - right) / 2;
+					}
+				}
+			}
+		}
+
+//        /// <summary>
+//        /// 横向绘制单行文本
+//        /// </summary>
+//        /// <param name="graphics">Graphics</param>
+//        /// <param name="textRectangleFs">每个文字的范围</param>
+//        /// <param name="font">字体</param>
+//        /// <param name="textBrush">文本笔刷</param>
+//        /// <param name="selected">是否选择</param>
+//        /// <returns>文本行间隔范围</returns>
+//        private static RectangleF DrawStringRow(
+//                    Graphics graphics,
+//                    List<TextRectangleF> textRectangleFs,
+//                    Font font,
+//                    SolidBrush textBrush,
+//                    bool selected)
+//        {
+//            //if (0 < textRectangleFs.Count)
+//            {
+//                //// 文字绘制范围
+//                //float width = textRectangleFs[textRectangleFs.Count - 1].RectangleF.Right
+//                //        - textRectangleFs[0].RectangleF.Left;
+//                //RectangleF selectedRectangleF =
+//                //    new RectangleF(textRectangleFs[0].RectangleF.Left,
+//                //                   textRectangleFs[0].RectangleF.Top,
+//                //                   width,
+//                //                   textRectangleFs[0].RectangleF.Height);
+
+//                //RectangleF lineSpaceSelectedRectangleF = RectangleF.Empty;
+//                //if (selected)
+//                //{
+//                //    // 选择状态文字的背景绘制
+//                //    graphics.FillRectangle(LayoutCommon.SelectedBrush, selectedRectangleF);
+//                //    lineSpaceSelectedRectangleF.X = selectedRectangleF.Left;
+//                //    lineSpaceSelectedRectangleF.Y = selectedRectangleF.Bottom;
+//                //    lineSpaceSelectedRectangleF.Width = selectedRectangleF.Width;
+//                //}
+//                foreach (TextRectangleF rf in textRectangleFs)
+//                {
+//#if DRAWTEST
+//                    graphics.DrawRectangle(new Pen(Color.Blue, 0.1f), rf.RectangleF.X, rf.RectangleF.Y, rf.RectangleF.Width, rf.RectangleF.Height);
+//#endif
+//                    graphics.DrawString(rf.Text, font, textBrush, rf.RectangleF,
+//                        LayoutCommon.StringFormatHorizontal);
+//                }
+//                textRectangleFs.Clear();
+//                //return lineSpaceSelectedRectangleF;
+//            }
+//        }
+		#endregion 绘制文本
+		#endregion 函数
+	}
+}

+ 160 - 0
DK.Service/InvoiceLayout/DataModel/LayoutConsts.cs

@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:LayoutConsts.cs
+ *		2.功能描述:常量类
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	public static class LayoutConsts
+	{
+		/// <summary>
+		/// 毫米和像素的转换系数
+		/// </summary>
+		public const float MILLIMETER_PER_INCH = 25.4f;
+		/// <summary>
+		/// 磅和像素的转换系数
+		/// </summary>
+		public const float POINT_PER_INCH = 72f;
+		/// <summary>
+		/// JPEG压缩比率,自动压缩时使用。
+		/// </summary>
+		public const long QUALITY_VALUE = 20L;
+        ///// <summary>
+        ///// 图片文件名过滤器
+        ///// </summary>
+        //public const string FILE_DIALOG_IMAGE_FILTER = "BMP(*.bmp)|*.bmp"
+        //		+ "|GIF(*.gif)|*.gif"
+        //		+ "|JPEG(*.jpg,*.jpeg,*.jpe)|*.jpg;*.jpeg;*.jpe"
+        //		+ "|PNG(*.png)|*.png"
+        //		+ "|TIFF(*.tif,*.tiff)|*.tif;*.tiff"
+        //		+ "|全部图片|*.bmp;*.gif;*.jpg;*.jpeg;*.jpe;*.png;*.tif;*.tiff";
+        ///// <summary>
+        ///// 图片最大尺寸200kbyte(200 * 1024byte)
+        ///// </summary>
+        //public const int FILE_DIALOG_IMAGE_MAX_SIZE = 204800;//200 * 1024;
+        /// <summary>
+        /// Layout余白(Pixel)
+        /// </summary>
+        //public const int LAYOUT_MARGIN = 4;
+        ///// <summary>
+        ///// Item的位置上限(mm)
+        ///// </summary>
+        //public const float ITEM_LOCATION_MAX = 999.9f;
+        ///// <summary>
+        ///// Item的位置初期値
+        ///// </summary>
+        //public const float ITEM_LOCATION_DEF = 10.0f;
+        ///// <summary>
+        ///// Item的位置下限(mm)
+        ///// </summary>
+        //public const float ITEM_LOCATION_MIN = 0.0f;
+        ///// <summary>
+        ///// Item的尺寸宽上限(mm)
+        ///// </summary>
+        //public const float ITEM_SIZE_WIDTH_MAX = 999.9f;
+        ///// <summary>
+        ///// Item的尺寸高上限(mm)
+        ///// </summary>
+        //public const float ITEM_SIZE_HEIGHT_MAX = 999.9f;
+        ///// <summary>
+        ///// Item的尺寸下限(mm)
+        ///// </summary>
+        //public const float ITEM_SIZE_MIN = 1.0f;
+        ///// <summary>
+        ///// 用紙尺寸上限(mm)
+        ///// </summary>
+        //public const float PAPER_SIZE_MAX = 420.0f;
+        ///// <summary>
+        ///// 用紙尺寸下限(mm)
+        ///// </summary>
+        //public const float PAPER_SIZE_MIN = 50.0f;
+        /// <summary>
+        /// Item的四周的余白(mm)
+        /// </summary>
+        public const float TEXT_MARGIN = 0.5f;
+        ///// <summary>
+        ///// Item的左侧余白(mm)
+        ///// </summary>
+        //public const float TEXT_MARGIN_LEFT = 0.5f;
+        ///// <summary>
+        ///// Item的右侧余白(mm)
+        ///// </summary>
+        //public const float TEXT_MARGIN_RIGHT = 0.5f;
+        ///// <summary>
+        ///// Item的上方余白(mm)
+        ///// </summary>
+        //public const float TEXT_MARGIN_TOP = 0.5f;
+        ///// <summary>
+        ///// Item的下方余白(mm)
+        ///// </summary>
+        //public const float TEXT_MARGIN_BOTTOM = 0.5f;
+        ///// <summary>
+        ///// 图形Item的默认宽
+        ///// </summary>
+        //public const float SHAPE_ITEM_SIZE_DEFAULT_WIDTH = 50.0f;
+        ///// <summary>
+        ///// 图形Item的默认高
+        ///// </summary>
+        //public const float SHAPE_ITEM_SIZE_DEFAULT_HEIGHT = 50.0f;
+        ///// <summary>
+        ///// CULTUREINFO-JP
+        ///// </summary>
+        //public const string CULTUREINFO_JP = "ja-JP";
+        ///// <summary>
+        ///// CULTUREINFO-US
+        ///// </summary>
+        //public const string CULTUREINFO_US = "en-US";
+        /// <summary>
+        /// 半角空格(字符)
+        /// </summary>
+        public const char SPACE_HALFSHAPE_CHAR = ' ';
+        ///// <summary>
+        ///// 半角空格(字符串)
+        ///// </summary>
+        //public const string SPACE_HALFSHAPE_TEXT = " ";
+        /// <summary>
+        /// 全角空格(字符)
+        /// </summary>
+        public const char SPACE_FULLSHAPE_CHAR = ' ';
+        ///// <summary>
+        ///// 全角空格(字符串)
+        ///// </summary>
+        //public const string SPACE_FULLSHAPE_TEXT = " ";
+        ///// <summary>
+        ///// 半角(字符)
+        ///// </summary>
+        //public const char HALFSHAPE_CHAR = '0';
+        /// <summary>
+        /// 半角(字符串)
+        /// </summary>
+        public const string HALFSHAPE_TEXT = "0";
+        ///// <summary>
+        ///// 全角(字符)
+        ///// </summary>
+        //public const char FULLSHAPE_CHAR = '全';
+        /// <summary>
+        /// 全角(字符串)
+        /// </summary>
+        public const string FULLSHAPE_TEXT = "全";
+        ///// <summary>
+        ///// Item的默认字体的FontFamily
+        ///// </summary>
+        //public const string ITEM_FONT_FAMILYNAME_DEFAULT = "宋体";
+        ///// <summary>
+        ///// Item的默认字体的em尺寸(磅)
+        ///// </summary>
+        //public const float ITEM_FONT_EMSIZE_DEFAULT = 10.0f;
+        /// <summary>
+        /// 日期默认格式化字符串
+        /// </summary>
+        public const string DATETIME_FRORMAT = "yyyy/MM/dd";
+        /// <summary>
+        /// 日期格式化字符串-MMM
+        /// </summary>
+        public const string DATETIME_FRORMAT_MMM = "MMM";
+    }
+}

+ 408 - 0
DK.Service/InvoiceLayout/DataModel/LayoutObjects.cs

@@ -0,0 +1,408 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:LayoutObjects.cs
+ *		2.功能描述:相关对象定义
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.ComponentModel;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	#region enum
+	#region public enum
+	/// <summary>
+	/// Item类别
+	/// </summary>
+	public enum ItemType
+	{
+		/// <summary>
+		/// 文本
+		/// </summary>
+		Text = 0,
+		/// <summary>
+		/// 图片
+		/// </summary>
+		Image = 1,
+		/// <summary>
+		/// 矩形
+		/// </summary>
+		Rectangle = 3,
+		/// <summary>
+		/// 椭圆
+		/// </summary>
+		Ellipse = 4,
+		/// <summary>
+		/// 表格
+		/// </summary>
+		Grid = 5,
+		/// <summary>
+		/// 页码
+		/// </summary>
+		PageNum = 6,
+		/// <summary>
+		/// 合计文本
+		/// </summary>
+		TotalText = 7,
+		/// <summary>
+		/// 条码文本
+		/// </summary>
+		Barcode = 8,
+	}
+
+	/// <summary>
+	/// Layout的编辑模式
+	/// </summary>
+	public enum LayoutMode
+	{
+		/// <summary>
+		/// 显示模式
+		/// </summary>
+		Display = 0,
+		/// <summary>
+		/// 编辑模式
+		/// </summary>
+		Edit = 1,
+		/// <summary>
+		/// 打印预览模式
+		/// </summary>
+		Preview = 2,
+	}
+
+	/// <summary>
+	/// Layout中Item的对齐类型
+	/// </summary>
+	public enum ArrangeType
+	{
+		/// <summary>
+		/// 左对齐
+		/// </summary>
+		Left = 0,
+		/// <summary>
+		/// 右对齐
+		/// </summary>
+		Right = 1,
+		/// <summary>
+		/// 左右中央对齐
+		/// </summary>
+		HorizontalCenter = 2,
+		/// <summary>
+		/// 上对齐
+		/// </summary>
+		Top = 3,
+		/// <summary>
+		/// 下对齐
+		/// </summary>
+		Bottom = 4,
+		/// <summary>
+		/// 上下中央对齐
+		/// </summary>
+		VerticalCenter = 5,
+		/// <summary>
+		/// 左右对齐
+		/// </summary>
+		LeftRight = 6,
+		/// <summary>
+		/// 上下对齐
+		/// </summary>
+		TopBottom = 7,
+	}
+
+	/// <summary>
+	/// Item排序
+	/// </summary>
+	public enum MovingPosition
+	{
+		/// <summary>
+		/// 最前面
+		/// </summary>
+		Foremost = 0,
+		/// <summary>
+		/// 最背面
+		/// </summary>
+		Aftermost = 1,
+		/// <summary>
+		/// 前面
+		/// </summary>
+		Front = 2,
+		/// <summary>
+		/// 背面
+		/// </summary>
+		Back = 3,
+	}
+
+	/// <summary>
+	/// 文本Item的文本对齐方式
+	/// </summary>
+	public enum TextAlignment
+	{
+		/// <summary>
+		/// 左对齐/上对齐
+		/// </summary>
+		LeftOrTop = 0,
+		/// <summary>
+		/// 右对齐/下对齐
+		/// </summary>
+		RightOrBottom = 1,
+		/// <summary>
+		/// 中央对齐
+		/// </summary>
+		Center = 2,
+		/// <summary>
+		/// 平均对齐
+		/// </summary>
+		Evenness = 3,
+	}
+
+	/// <summary>
+	/// 文本Item的文本绘制方向
+	/// </summary>
+	public enum TextDirection
+	{
+		/// <summary>
+		/// 横向
+		/// </summary>
+		Horizontal = 0,
+		/// <summary>
+		/// 纵向
+		/// </summary>
+		Vertical = 1,
+	}
+
+	/// <summary>
+	/// 显示比例类型
+	/// </summary>
+	public enum ZoomType
+	{
+		/// <summary>
+		/// 全体表示
+		/// </summary>
+		Whole = 0,
+		/// <summary>
+		/// 比例指定
+		/// </summary>
+		Specify = 1,
+	}
+
+	/// <summary>
+	/// 打印时的偏移模式
+	/// </summary>
+	public enum PrintOffset
+	{
+		/// <summary>
+		/// 左对齐
+		/// </summary>
+		Left = 0,
+		/// <summary>
+		/// 右对齐
+		/// </summary>
+		Right = 1,
+		/// <summary>
+		/// 中央对齐
+		/// </summary>
+		Center = 2,
+	}
+
+	/// <summary>
+	/// 割付方向
+	/// </summary>
+	public enum AllocationDirection
+	{
+		/// <summary>
+		/// 横方向
+		/// </summary>
+		Horizontal = 0,
+		/// <summary>
+		/// 縦方向
+		/// </summary>
+		Vertical = 1,
+	}
+
+	/// <summary>
+	/// Item变更类别
+	/// </summary>
+	public enum ItemChangeType
+	{
+		/// <summary>
+		/// 无变化
+		/// </summary>
+		Unchanged = 0,
+		/// <summary>
+		/// 新建
+		/// </summary>
+		Added = 1,
+		/// <summary>
+		/// 删除
+		/// </summary>
+		Deleted = 2,
+		/// <summary>
+		/// 属性变更
+		/// </summary>
+		Modified = 3,
+		/// <summary>
+		/// 移动
+		/// </summary>
+		Moved = 4,
+	}
+
+	/// <summary>
+	/// Item项目类别
+	/// </summary>
+	public enum ItemStyle
+	{
+		/// <summary>
+		/// 其他
+		/// </summary>
+		Other = 0,
+		/// <summary>
+		/// 文本
+		/// </summary>
+		Text = 1,
+		/// <summary>
+		/// 日期
+		/// </summary>
+		Date = 2,
+		/// <summary>
+		/// 符号
+		/// </summary>
+		Sign = 3,
+		/// <summary>
+		/// 合计文本
+		/// </summary>
+		TotalText = 4,
+		/// <summary>
+		/// 条码文本
+		/// </summary>
+		Barcode = 5,
+        /// <summary>
+        /// 二维码文本
+        /// </summary>
+        QRCode = 6,
+    }
+	#endregion public enum
+
+	#region internal enum
+	/// <summary>
+	/// Item锁定类别
+	/// </summary>
+	internal enum ItemLock
+	{
+		/// <summary>
+		/// 无
+		/// </summary>
+		None = 0,
+		/// <summary>
+		/// 锁定尺寸
+		/// </summary>
+		LockSize = 1,
+		/// <summary>
+		/// 锁定位置和尺寸
+		/// </summary>
+		LockLocationAndSize = 2,
+	}
+
+	/// <summary>
+	/// GridColumnState
+	/// </summary>
+	internal enum GridColumnState
+	{
+		/// <summary>
+		/// 分离
+		/// </summary>
+		Detached = 0,
+		/// <summary>
+		/// 无变化
+		/// </summary>
+		Unchanged = 1,
+		/// <summary>
+		/// 新建
+		/// </summary>
+		Added = 2,
+		/// <summary>
+		/// 删除
+		/// </summary>
+		Deleted = 3,
+		/// <summary>
+		/// 属性变更
+		/// </summary>
+		Modified = 4,
+	}
+
+	/// <summary>
+	/// 打印类别
+	/// </summary>
+	internal enum PrintType
+	{
+		/// <summary>
+		/// 打印测试
+		/// </summary>
+		PrintTest = 0,
+		/// <summary>
+		/// 通常打印
+		/// </summary>
+		Print = 1,
+		/// <summary>
+		/// 分割打印
+		/// </summary>
+		AllocationPrint = 2,
+		/// <summary>
+		/// 通常打印预览
+		/// </summary>
+		PrintPreview = 3,
+		/// <summary>
+		/// 分割打印预览
+		/// </summary>
+		AllocationPrintPreview = 4,
+	}
+	#endregion internal enum
+	#endregion enum
+
+	#region struct
+	#region internal struct
+	/// <summary>
+	/// 数据绑定字段
+	/// </summary>
+	internal struct DataBoundField
+	{
+		/// <summary>
+		/// 是否绑定成功
+		/// </summary>
+		public bool IsDataBound;
+		/// <summary>
+		/// 绑定字段索引
+		/// </summary>
+		public int BoundFieldIndex;
+		/// <summary>
+		/// 属性类型转换器
+		/// </summary>
+		public TypeConverter BoundFieldConverter;
+		/// <summary>
+		/// 属性类型
+		/// </summary>
+		public Type ValueType;
+	}
+	#endregion internal struct
+	#endregion struct
+
+	#region delegate
+	///// <summary>
+	///// 新建,删除,移动,变更Item时,发生的事件。
+	///// </summary>
+	//public delegate void ItemChangedEventHandler(object sender, ItemChangedEventArgs e);
+
+	///// <summary>
+	///// Item的选择状态变更时,发生的事件。
+	///// </summary>
+	//public delegate void ItemSelectionChangedEventHandler(object sender, ItemSelectionChangedEventArgs e);
+
+	///// <summary>
+	///// Item显示内容前,发生的事件。
+	///// </summary>
+	///// <param name="sender">指定的对象</param>
+	///// <param name="e">提供的事件数据</param>
+	//public delegate void ItemValueFormattingEventHandler(object sender, ItemValueFormattingEventArgs e);
+	#endregion delegate
+}

+ 29 - 0
DK.Service/InvoiceLayout/DataModel/PropertyOfLayoutBox.cs

@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:PropertyOfLayoutBox.cs
+ *		2.功能描述:Layout的序列化属性封装
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Collections;
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class PropertyOfLayoutBox
+	{
+		public int NewItemID;
+		public float PaperHeight;
+		public float PaperWidth;
+		public ArrayList Items;
+		public Image BackgroundImage;
+		public string BackgroundImageName;
+		public bool PrintAreaVisible;
+		public bool PrintBackground;
+		public RectangleF LastItemRF;
+	}
+}

+ 103 - 0
DK.Service/InvoiceLayout/DataModel/TextRectangleF.cs

@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:TextRectangleF.cs
+ *		2.功能描述:绘制文字的范围
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	internal class TextRectangleF
+	{
+		#region 成员变量
+		private string _text = string.Empty;								// 文字
+		private RectangleF _rectangle = RectangleF.Empty;		// 范围
+		#endregion 成员变量
+
+		#region Layout
+		/// <summary>
+		/// 文字
+		/// </summary>
+		public string Text
+		{
+			get
+			{
+				return _text;
+			}
+			set
+			{
+				_text = value;
+			}
+		}
+
+		/// <summary>
+		/// 范围
+		/// </summary>
+		public RectangleF RectangleF
+		{
+			get
+			{
+				return _rectangle;
+			}
+			set
+			{
+				_rectangle = value;
+			}
+		}
+
+		/// <summary>
+		/// 范围X
+		/// </summary>
+		public float RectangleX
+		{
+			get
+			{
+				return _rectangle.X;
+			}
+			set
+			{
+				_rectangle.X = value;
+			}
+		}
+
+		/// <summary>
+		/// 范围Y
+		/// </summary>
+		public float RectangleY
+		{
+			get
+			{
+				return _rectangle.Y;
+			}
+			set
+			{
+				_rectangle.Y = value;
+			}
+		}
+		#endregion Layout
+
+		#region 构造函数
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		/// <param name="text">文字</param>
+		/// <param name="rf">范围</param>
+		public TextRectangleF(string text, RectangleF rectangle)
+		{
+			_text = text;
+			_rectangle = rectangle;
+		}
+
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		public TextRectangleF()
+		{
+		}
+		#endregion 构造函数
+	}
+}

+ 89 - 0
DK.Service/InvoiceLayout/InvoiceLayout.csproj

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{440B03E6-474C-439A-AF83-900A01A57ABE}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>InvoiceLayout</RootNamespace>
+    <AssemblyName>InvoiceLayout</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <StartupObject />
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Curtain.Framework">
+      <HintPath>..\..\DLL\Curtain.Framework.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="zxing">
+      <HintPath>..\..\DLL\zxing.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="BarcodeDraw.cs" />
+    <Compile Include="Common\LayoutCommon.cs" />
+    <Compile Include="Common\LayoutUtility.cs" />
+    <Compile Include="DataModel\LayoutConsts.cs" />
+    <Compile Include="DataModel\LayoutObjects.cs" />
+    <Compile Include="DataModel\PropertyOfLayoutBox.cs" />
+    <Compile Include="DataModel\TextRectangleF.cs" />
+    <Compile Include="Items\DataGridItem\GridItem.cs" />
+    <Compile Include="Items\DataGridItem\GridItemColumn.cs" />
+    <Compile Include="Items\DataGridItem\GridItemColumnCollection.cs" />
+    <Compile Include="Items\DataGridItem\PageNumItem.cs" />
+    <Compile Include="Items\DataGridItem\TotalTextItem.cs" />
+    <Compile Include="Items\EllipseItem.cs" />
+    <Compile Include="Items\GraphicsItem.cs" />
+    <Compile Include="Items\IBoundItem.cs" />
+    <Compile Include="Items\ImageItem.cs" />
+    <Compile Include="Items\LayoutItem.cs" />
+    <Compile Include="Items\RectangleItem.cs" />
+    <Compile Include="Items\TextItem.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 1291 - 0
DK.Service/InvoiceLayout/Items/DataGridItem/GridItem.cs

@@ -0,0 +1,1291 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:GridItem.cs
+ *		2.功能描述:表格Item
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Data;
+using System.Drawing;
+using System.Collections.Generic;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class GridItem : GraphicsItem
+	{
+		#region 成员变量
+		// Grid列集合
+		private GridItemColumnCollection _gridItemColumns = null;
+		// 是否显示列标题
+		private bool _titleVisible = true;
+		// 是否每页都显示列标题
+		private bool _alwaysTitleVisible = true;
+		// 行高
+		private float _rowsHeight = 0;
+		// 行高
+		private float _rowsHeightHead = 0;
+		// 行高-描画用
+		private float _rowsHeightDraw = 0;
+		// 行高-描画用
+		private float _rowsHeightHeadDraw = 0;
+		// 一页显示的行数
+		private int _displayRowCount = 5;
+
+		// 数据排序 "displayno"
+		private string _dataSort = null;
+		// 和主表的数据关系 "id={0} and num>{1}"
+		private string _dataRelation = null;
+		// 关系列名 "id,num"
+		private string _relationColNames = null;
+
+		// 打印页的起始行
+		[NonSerialized]
+		private int _printRowIndex = 0;
+		// 总页数(打印)
+		[NonSerialized]
+		private int _printTotalPageNum = 0;
+		// 数据源(打印)
+		[NonSerialized]
+		private DataTable _printGridSource = null;
+		[NonSerialized]
+		private DataView _printDataView = null;
+		[NonSerialized]
+		private string _printDataFilter = null;
+
+		internal void ReSetDataFilter(DataRowView dataRow)
+		{
+			this._dataFilter = null;
+			if (dataRow == null)
+			{
+				return;
+			}
+			if (string.IsNullOrEmpty(this._dataRelation))
+			{
+				return;
+			}
+			if (string.IsNullOrEmpty(this._relationColNames))
+			{
+				return;
+			}
+			string[] colNames = this._relationColNames.Split(',');
+
+			List<object> colValues = new List<object>();
+
+			DataColumnCollection dcc = dataRow.Row.Table.Columns;
+			foreach (string colName in colNames)
+			{
+				if (dcc.Contains(colName))
+				{
+					colValues.Add(dataRow[colName]);
+				}
+				else
+				{
+					return;
+				}
+			}
+
+			this._dataFilter = string.Format(this._dataRelation, colValues.ToArray());
+			this.RefreshDataView();
+		}
+
+		internal void ReSetPrintDataFilter(DataRowView dataRow)
+		{
+			this._printDataFilter = null;
+			if (dataRow == null)
+			{
+				return;
+			}
+			if (string.IsNullOrEmpty(this._dataRelation))
+			{
+				return;
+			}
+			if (string.IsNullOrEmpty(this._relationColNames))
+			{
+				return;
+			}
+			string[] colNames = this._relationColNames.Split(',');
+
+			List<object> colValues = new List<object>();
+
+			DataColumnCollection dcc = dataRow.Row.Table.Columns;
+			foreach (string colName in colNames)
+			{
+				if (dcc.Contains(colName))
+				{
+					colValues.Add(dataRow[colName]);
+				}
+				else
+				{
+					return;
+				}
+			}
+
+			this._printDataFilter = string.Format(this._dataRelation, colValues.ToArray());
+			this.RefreshPrintDataView();
+		}
+
+		internal void RefreshDataView()
+		{
+			if (this._gridSource == null)
+			{
+				this._dataView = null;
+				return;
+			}
+
+			this._dataView = this._gridSource.DefaultView;
+			if (!string.IsNullOrEmpty(this._dataFilter))
+			{
+				this._dataView.RowFilter = this._dataFilter;
+			}
+			if (!string.IsNullOrEmpty(this._dataSort))
+			{
+				this._dataView.Sort = this._dataSort;
+			}
+			SetTotalPageNum();
+		}
+
+		internal void RefreshPrintDataView()
+		{
+			if (this._printGridSource == null)
+			{
+				this._printDataView = null;
+				return;
+			}
+
+			this._printDataView = this._printGridSource.DefaultView;
+			if (!string.IsNullOrEmpty(this._printDataFilter))
+			{
+				this._printDataView.RowFilter = this._printDataFilter;
+			}
+			if (!string.IsNullOrEmpty(this._dataSort))
+			{
+				this._printDataView.Sort = this._dataSort;
+			}
+			SetPrintTotalPageNum();
+		}
+
+		// 当前页的起始行
+		[NonSerialized]
+		private int _displayRowIndex = 0;
+		// 总页数
+		[NonSerialized]
+		private int _totalPageNum = 0;
+		// 数据源(显示)
+		[NonSerialized]
+		private DataTable _gridSource = null;
+		[NonSerialized]
+		private DataView _dataView = null;
+		[NonSerialized]
+		private string _dataFilter = null;
+		// 数据源名
+		private string _gridDataMember;
+		#endregion 成员变量
+
+		#region 属性
+		/// <summary>
+		/// 数据源名
+		/// </summary>
+		public string GridDataMember
+		{
+			get
+			{
+				return _gridDataMember;
+			}
+			set
+			{
+				if (_gridDataMember != value)
+				{
+					_gridDataMember = value;
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 是否显示列标题
+		/// </summary>
+		public bool TitleVisible
+		{
+			get
+			{
+				return _titleVisible;
+			}
+			set
+			{
+				if (_titleVisible != value)
+				{
+					_titleVisible = value;
+					SetTotalPageNum();
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 是否每页都显示列标题
+		/// </summary>
+		public bool AlwaysTitleVisible
+		{
+			get
+			{
+				return _alwaysTitleVisible;
+			}
+			set
+			{
+				if (_alwaysTitleVisible != value)
+				{
+					_alwaysTitleVisible = value;
+					SetTotalPageNum();
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 行高
+		/// </summary>
+		public float RowsHeight
+		{
+			get
+			{
+				return _rowsHeight;
+			}
+			set
+			{
+				if (_rowsHeight != value)
+				{
+					_rowsHeight = value;
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 列头行高
+		/// </summary>
+		public float HeadRowsHeight
+		{
+			get
+			{
+				return _rowsHeightHead;
+			}
+			set
+			{
+				if (_rowsHeightHead != value)
+				{
+					_rowsHeightHead = value;
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 一页显示的行数
+		/// </summary>
+		public int DisplayRowCount
+		{
+			get
+			{
+				return _displayRowCount;
+			}
+			set
+			{
+				if (_displayRowCount != value)
+				{
+					_displayRowCount = value;
+					SetTotalPageNum();
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 当前页的起始行
+		/// </summary>
+		public int DisplayRowIndex
+		{
+			get
+			{
+				return _displayRowIndex;
+			}
+		}
+
+		/// <summary>
+		/// 打印页的起始行
+		/// </summary>
+		internal int PrintRowIndex
+		{
+			get
+			{
+				return _printRowIndex;
+			}
+		}
+
+		/// <summary>
+		/// Grid列集合
+		/// </summary>
+		public GridItemColumnCollection Columns
+		{
+			get
+			{
+				return _gridItemColumns;
+			}
+			internal set
+			{
+				if (_gridItemColumns != value)
+				{
+					_gridItemColumns = value;
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified, "Columns");
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 数据源
+		/// </summary>
+		public DataTable GridSource
+		{
+			get
+			{
+				return _gridSource;
+			}
+			set
+			{
+				if (_gridSource != value)
+				{
+					_gridSource = value;
+					this.RefreshDataView();
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 总页数
+		/// </summary>
+		public int TotalPageNum
+		{
+			get
+			{
+				return _totalPageNum;
+			}
+			private set
+			{
+				_totalPageNum = value;
+			}
+		}
+
+		/// <summary>
+		/// 总页数(打印用)
+		/// </summary>
+		internal int PrintTotalPageNum
+		{
+			get
+			{
+				return _printTotalPageNum;
+			}
+			private set
+			{
+				_printTotalPageNum = value;
+			}
+		}
+
+		/// <summary>
+		/// 数据源
+		/// </summary>
+		public DataTable PrintGridSource
+		{
+			get
+			{
+				return _printGridSource;
+			}
+			set
+			{
+				if (_printGridSource != value)
+				{
+					_printGridSource = value;
+					this.RefreshPrintDataView();
+					//if (_owner != null)
+					//{
+					//	_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 数据排序 "displayno"
+		/// </summary>
+		public string DataSort
+		{
+			get
+			{
+				return _dataSort;
+			}
+			set
+			{
+				_dataSort = value;
+				//ReSetDataFilter();
+			}
+		}
+
+		/// <summary>
+		/// 和主表的数据关系 【明细表中的列作为条件】 "id={0} and num>{1}"
+		/// </summary>
+		public string DataRelation
+		{
+			get
+			{
+				return _dataRelation;
+			}
+			set
+			{
+				_dataRelation = value;
+				//ReSetDataFilter();
+			}
+		}
+
+		/// <summary>
+		/// 关系列名 【主表中的列名】 "id,num"
+		/// </summary>
+		public string RelationColNames
+		{
+			get
+			{
+				return _relationColNames;
+			}
+			set
+			{
+				_relationColNames = value;
+				//ReSetDataFilter();
+			}
+		}
+		
+		#endregion 属性
+
+		#region 构造函数
+		///// <summary>
+		///// 构造函数
+		///// </summary>
+		//internal GridItem()
+		//	: this(null)
+		//{
+		//}
+
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		/// <param name="box"></param>
+		internal GridItem(/*LayoutBox box*/)
+			: base(/*box,*/ ItemType.Grid)
+		{
+            //_width = LayoutConsts.SHAPE_ITEM_SIZE_DEFAULT_WIDTH;
+            //_height = LayoutConsts.SHAPE_ITEM_SIZE_DEFAULT_HEIGHT;
+            _displayRowIndex = -1;
+            _printRowIndex = -1;
+            //_rowsHeight = LayoutCommon.DefaultTextItemSizeHeight;
+            //_rowsHeightDraw = LayoutCommon.DefaultTextItemSizeHeight;
+            //_rowsHeightHead = LayoutCommon.DefaultTextItemSizeHeight;
+            //_rowsHeightHeadDraw = LayoutCommon.DefaultTextItemSizeHeight;
+            _gridItemColumns = new GridItemColumnCollection(this);
+		}
+        #endregion 构造函数
+
+        #region 函数
+        ///// <summary>
+        ///// 显示Item属性设置画面
+        ///// </summary>
+        ///// <returns>
+        ///// DialogResult.OK:选中的Item有效,设置成功<br/>
+        ///// DialogResult.Cancel:选中的Item有效,取消设置<br/>
+        ///// DialogResult.None:LayoutBox不是编辑模式,或选中的Item不是一个
+        ///// </returns>
+        //protected override DialogResult ShowItemPropertyDialogInner()
+        //{
+        //	using (GridItemSetting itemPropertySetting = new GridItemSetting())
+        //	{
+        //		itemPropertySetting.ShapeLocationX = Left;
+        //		itemPropertySetting.ShapeLocationY = Top;
+        //		itemPropertySetting.ShapeWidth = Width;
+        //		itemPropertySetting.ShapeHeight = Height;
+        //		itemPropertySetting.LineColor = LineColor;
+        //		itemPropertySetting.FillColor = FillColor;
+        //		itemPropertySetting.LineWidth = LineWidth;
+        //		itemPropertySetting.Transparent = Transparent;
+        //		itemPropertySetting.TitleVisible = TitleVisible;
+        //		itemPropertySetting.AlwaysTitleVisible = AlwaysTitleVisible;
+        //		itemPropertySetting.RowsHeight = RowsHeight;
+        //		itemPropertySetting.HeadRowsHeight = HeadRowsHeight;
+        //		itemPropertySetting.RowsCount = DisplayRowCount;
+        //		itemPropertySetting.Columns = Columns.CopyTo();
+        //		DialogResult result = itemPropertySetting.ShowDialog();
+        //		if (result == DialogResult.OK)
+        //		{
+        //			Left = itemPropertySetting.ShapeLocationX;
+        //			Top = itemPropertySetting.ShapeLocationY;
+        //			Width = itemPropertySetting.ShapeWidth;
+        //			Height = itemPropertySetting.ShapeHeight;
+        //			LineColor = itemPropertySetting.LineColor;
+        //			FillColor = itemPropertySetting.FillColor;
+        //			LineWidth = itemPropertySetting.LineWidth;
+        //			Transparent = itemPropertySetting.Transparent;
+        //			TitleVisible = itemPropertySetting.TitleVisible;
+        //			AlwaysTitleVisible = itemPropertySetting.AlwaysTitleVisible;
+        //			DisplayRowCount = itemPropertySetting.RowsCount;
+        //			RowsHeight = itemPropertySetting.RowsHeight;
+        //			HeadRowsHeight = itemPropertySetting.HeadRowsHeight;
+        //			if (itemPropertySetting.ColumnsChanged)
+        //			{
+        //				itemPropertySetting.Columns.GridItem = this;
+        //				Columns = itemPropertySetting.Columns;
+        //			}
+        //			ResetItemFrame();
+        //			SetDrawProperty();
+        //			Owner.Dirty = true;
+        //		}
+        //		return result;
+        //	}
+        //}
+
+        /// <summary>
+        /// 初期化
+        /// </summary>
+        /// <param name="isNewID">是否使用新的ID</param>
+        internal override bool Init(/*LayoutBox box, bool isNewID*/)
+		{
+			_displayRowIndex = -1;
+			_printRowIndex = -1;
+			bool isInit = base.Init(/*box, isNewID*/);
+			//if (isInit && isNewID)
+			//{
+			//	foreach (GridItemColumn gic in _gridItemColumns)
+			//	{
+			//		gic.ID = box.NewItemID;
+			//	}
+			//}
+			return isInit;
+		}
+
+		///// <summary>
+		///// OnPaint事件
+		///// </summary>
+		///// <param name="sender">指定的对象</param>
+		///// <param name="e">提供的事件数据</param>
+		//protected override void OnPaint(object sender, PaintEventArgs e)
+		//{
+		//	float zoom = GetZoom();
+		//	RectangleF rectangle = new RectangleF();
+		//	rectangle.X = Left * zoom;
+		//	rectangle.Y = Top * zoom;
+		//	rectangle.Width = Width * zoom;
+		//	rectangle.Height = Height * zoom;
+		//	int pageNum = (_owner == null) ? 1 : _owner.CurrentPageNum;
+		//	DrawGridItem(e.Graphics, rectangle, zoom, pageNum);
+		//}
+
+		internal void DrawGridItem(Graphics graphics, RectangleF rectangle, float zoom, int pageNum)
+		{
+			DrawGridItemInn(graphics, rectangle, zoom, pageNum, false);
+		}
+
+        public void PrintGridItem(Graphics graphics, RectangleF rectangle, int pageNum)
+		{
+			DrawGridItemInn(graphics, rectangle, 1, pageNum, true);
+		}
+
+		/// <summary>
+		/// 绘制GridItem
+		/// </summary>
+		/// <param name="graphics">Graphics</param>
+		/// <param name="rectangle">表格的范围</param>
+		/// <param name="zoom">缩放比例</param>
+		/// <param name="pageNum">显示第几页</param>
+		private void DrawGridItemInn(Graphics graphics, RectangleF rectangle, float zoom, int pageNum, bool isPrint)
+		{
+			//GraphicsUnit gUnit = graphics.PageUnit;
+			//if (gUnit != GraphicsUnit.Millimeter)
+			//{
+			//    graphics.PageUnit = GraphicsUnit.Millimeter;
+			//}
+			////Region gClip = graphics.Clip;
+			////graphics.IntersectClip(rectangle);
+			//Region gClip = graphics.Clip.Clone();
+			//graphics.SetClip(rectangle, System.Drawing.Drawing2D.CombineMode.Intersect);
+			////rectangle = graphics.ClipBounds;
+			////rectangle = graphics.Clip.GetBounds(graphics);
+
+			System.Drawing.Drawing2D.GraphicsContainer containerState = graphics.BeginContainer();
+			graphics.PageUnit = GraphicsUnit.Millimeter;
+			graphics.SetClip(rectangle, System.Drawing.Drawing2D.CombineMode.Intersect);
+			// 绘制背景
+			if (!_isTransparent && _fillColor != Color.Transparent)
+			{
+				graphics.FillRectangle(new SolidBrush(_fillColor), rectangle);
+			}
+
+			//_colHeadHeightDraw = _colHeadHeight * zoom;
+
+			_rowsHeightDraw = _rowsHeight * zoom;
+			_rowsHeightHeadDraw = _rowsHeightHead * zoom;
+			_lineWidthDraw = _lineWidth * zoom;
+			// 绘制列
+			DrawGridColumnItem(graphics, zoom, pageNum, ref rectangle, isPrint);
+
+			// 绘制表格
+			if (_lineWidthDraw > 0 && _lineColor != Color.Transparent && rectangle != RectangleF.Empty)
+			{
+				// 横线
+				float linehw = _lineWidthDraw / 2;
+				PointF sp = new PointF(rectangle.Left, rectangle.Top + linehw);
+				PointF ep = new PointF(rectangle.Right, sp.Y);
+				LayoutUtility.DrawLine(graphics, GraphicsUnit.Millimeter, sp, ep, _lineColor, _lineWidthDraw);
+				if (_displayRowCount > 0)
+				{
+					for (int i = 0; i < _displayRowCount; i++)
+					{
+						if (_titleVisible && i == 0 && (_alwaysTitleVisible || pageNum == 1))
+						{
+							//sp.Y += _colHeadHeightDraw + _lineWidthDraw;
+							//sp.Y += _rowsHeightDraw + _lineWidthDraw;
+							sp.Y += _rowsHeightHeadDraw + _lineWidthDraw;
+						}
+						else
+						{
+							sp.Y += _rowsHeightDraw + _lineWidthDraw;
+						}
+
+						ep.Y = sp.Y;
+						LayoutUtility.DrawLine(graphics, GraphicsUnit.Millimeter, sp, ep, _lineColor, _lineWidthDraw);
+					}
+				}
+				else
+				{
+					sp.Y = rectangle.Bottom - linehw;
+					ep.Y = sp.Y;
+					LayoutUtility.DrawLine(graphics, GraphicsUnit.Millimeter, sp, ep, _lineColor, _lineWidthDraw);
+				}
+
+				// 竖线
+				sp = new PointF(rectangle.Left + linehw, rectangle.Top);
+				ep = new PointF(sp.X, rectangle.Bottom);
+				LayoutUtility.DrawLine(graphics, GraphicsUnit.Millimeter, sp, ep, _lineColor, _lineWidthDraw);
+				if (_gridItemColumns.Count > 0)
+				{
+					for (int i = 0; i < _gridItemColumns.Count; i++)
+					{
+						sp.X += _gridItemColumns[i].Width * zoom + _lineWidthDraw;
+						ep.X = sp.X;
+						LayoutUtility.DrawLine(graphics, GraphicsUnit.Millimeter, sp, ep, _lineColor, _lineWidthDraw);
+					}
+				}
+				else
+				{
+					sp.X = rectangle.Right - linehw;
+					ep.X = sp.X;
+					LayoutUtility.DrawLine(graphics, GraphicsUnit.Millimeter, sp, ep, _lineColor, _lineWidthDraw);
+				}
+			}
+			graphics.EndContainer(containerState);
+		}
+
+		/// <summary>
+		/// 绘制GridColumnItem
+		/// </summary>
+		/// <param name="graphics"></param>
+		/// <param name="zoom"></param>
+		/// <param name="pageNum"></param>
+		/// <param name="rectangle"></param>
+		private void DrawGridColumnItem(Graphics graphics, float zoom, int pageNum, ref RectangleF rectangle, bool isPrint)
+		{
+			int titleCount = 0;
+
+			if (_gridItemColumns.Count == 0 || _displayRowCount == 0)
+			{
+				rectangle = RectangleF.Empty;
+				return;
+			}
+
+			float lastLeft = rectangle.Left + _lineWidthDraw;
+			float lastTop = rectangle.Top + _lineWidthDraw;
+			float marginDraw = 0 - LayoutConsts.TEXT_MARGIN * zoom;
+			bool hasColsWidth = false;
+			float colsWidth = 0;
+
+			foreach (GridItemColumn col in _gridItemColumns)
+			{
+				col.FontDraw = new Font(col.Font.FontFamily, col.Font.Size * zoom, col.Font.Style);
+				col.WidthDraw = col.Width * zoom;
+				col.CharacterSpaceDraw = col.CharacterSpace * zoom;
+				col.LineSpaceDraw = col.LineSpace * zoom;
+				if (col.FontHead == null)
+				{
+					col.FontHeadDraw = new Font(col.Font.FontFamily, col.Font.Size * zoom, col.Font.Style);
+				}
+				else
+				{
+					col.FontHeadDraw = new Font(col.FontHead.FontFamily, col.FontHead.Size * zoom, col.FontHead.Style);
+				}
+				
+				col.CharacterSpaceHeadDraw = col.CharacterSpaceHead * zoom;
+				col.LineSpaceHeadDraw = col.LineSpaceHead * zoom;
+			}
+
+			DataView dvData = isPrint ? this._printDataView : this._dataView;
+			if (_titleVisible)
+			{
+				if (_alwaysTitleVisible || pageNum == 1)
+				{
+					foreach (GridItemColumn col in _gridItemColumns)
+					{
+						RectangleF rfM = new RectangleF();
+						rfM.X = lastLeft;
+						rfM.Y = lastTop;
+						rfM.Width = col.WidthDraw;
+						rfM.Height = _rowsHeightHeadDraw;
+						//rfM.Height = _rowsHeightDraw;
+						//rfM.Height = _colHeadHeightDraw;
+
+						RectangleF rf = rfM;
+						rf.Inflate(marginDraw, marginDraw);
+						rfM.Height += marginDraw;
+						//LayoutUtility.DrawText(graphics,
+						//        GraphicsUnit.Millimeter,
+						//        rfM,
+						//        rf,
+						//        col.HeaderText,
+						//        col.FontDraw,
+						//        col.TextColor,
+						//        col.LineSpaceDraw,
+						//        col.CharacterSpaceDraw,
+						//        col.CharacterCount,
+						//        //col.TextAlign,
+						//        //col.TextAlignVertical,
+						//        TextAlignment.Center,
+						//        TextAlignment.LeftOrTop,
+						//        col.Wrap,
+						//        col.Clip,
+						//        false);
+						LayoutUtility.DrawText(graphics,
+								GraphicsUnit.Millimeter,
+								rfM,
+								rf,
+								col.HeaderText,
+								col.FontHeadDraw,
+								col.TextColorHead,
+								col.LineSpaceHeadDraw,
+								col.CharacterSpaceHeadDraw,
+								col.CharacterCountHead,
+								col.TextAlignHead,
+								col.TextAlignVerticalHead,
+								col.WrapHead,
+								col.ClipHead,
+								false);
+
+						lastLeft += col.WidthDraw + _lineWidthDraw;
+						if (lastLeft >= rectangle.Right)
+						{
+							break;
+						}
+					}
+					colsWidth = lastLeft;
+					hasColsWidth = true;
+					lastTop += _rowsHeightHeadDraw + _lineWidthDraw;
+					//lastTop += _rowsHeightDraw + _lineWidthDraw;
+					//lastTop += _colHeadHeightDraw + _lineWidthDraw;
+					titleCount++;
+
+					if (_displayRowCount == 1)
+					{
+						rectangle.Width = lastLeft - rectangle.Left;
+						rectangle.Height = lastTop - rectangle.Top;
+						return;
+					}
+				}
+			}
+
+			//int index = Math.Max(GetRowIndexByPageNum(pageNum), 0);
+			int index = Math.Max((isPrint? GetPrintRowIndexByPageNum(pageNum) : GetRowIndexByPageNum(pageNum)), 0);
+			if (lastTop < rectangle.Bottom)
+			{
+				for (int j = titleCount; j < _displayRowCount; j++)
+				{
+					lastLeft = rectangle.Left + _lineWidthDraw;
+					foreach (GridItemColumn col in _gridItemColumns)
+					{
+						//if (_gridSource != null && (_gridSource.Rows.Count == 0 || index >= _gridSource.Rows.Count))
+						//if (this._dataView != null && (this._dataView.Count == 0 || index >= this._dataView.Count))
+						if (dvData != null && (dvData.Count == 0 || index >= dvData.Count))
+						{
+							if (hasColsWidth)
+							{
+								break;
+							}
+							lastLeft += col.WidthDraw + _lineWidthDraw;
+							continue;
+						}
+
+						RectangleF rfM = new RectangleF();
+						rfM.X = lastLeft;
+						rfM.Y = lastTop;
+						rfM.Width = col.WidthDraw;
+						rfM.Height = _rowsHeightDraw;
+
+						RectangleF rf = rfM;
+						rf.Inflate(marginDraw, marginDraw);
+						rfM.Height += marginDraw;
+						//string value = ResetTextValue(index, col);
+						//LayoutUtility.DrawText(graphics,
+						//        GraphicsUnit.Millimeter,
+						//        rfM,
+						//        rf,
+						//        value,
+						//        col.FontDraw,
+						//        col.TextColor,
+						//        col.LineSpaceDraw,
+						//        col.CharacterSpaceDraw,
+						//        col.CharacterCount,
+						//        col.TextAlign,
+						//        col.Wrap,
+						//        col.Clip,
+						//        false);
+						if (col.PicColumn)
+						{
+							//col.DataPropertyName = "timage";
+							//Image value = ResetTextValue(index, col) as Image;
+							Image value = (isPrint ? ResetPrintTextValue(index, col) : ResetTextValue(index, col)) as Image;
+							if (value != null)
+							{
+								RectangleF rfp = col.PicMargin ? rf : rfM;
+								if (col.FixedRatio)
+								{
+									// 背景图片的高宽比例
+									float imgWHRate = (float)value.Width / (float)value.Height;
+									// 打印纸张的高宽比例
+									float paperWHRate = rfp.Width / rfp.Height;
+
+									// 背景图片打印范围
+									RectangleF newImgRectangleF = RectangleF.Empty;
+
+									// 缩放背景图片,但保持图片高宽比例
+									if (imgWHRate > paperWHRate)
+									{
+										newImgRectangleF.Width = rfp.Width;
+										newImgRectangleF.Height = rfp.Width / imgWHRate;
+										newImgRectangleF.X = rfp.X;
+										newImgRectangleF.Y = (rfp.Height - newImgRectangleF.Height) / 2 + rfp.Y;
+									}
+									else
+									{
+										newImgRectangleF.Width = rfp.Height * imgWHRate;
+										newImgRectangleF.Height = rfp.Height;
+										newImgRectangleF.X = (rfp.Width - newImgRectangleF.Width) / 2 + rfp.X;
+										newImgRectangleF.Y = rfp.Y;
+									}
+									rfp = newImgRectangleF;
+								}
+								// 在指定的范围绘制背景图片
+								//graphics.DrawImage(value, rfp);
+								LayoutUtility.DrawImage(graphics, GraphicsUnit.Millimeter, rfp, value);
+							}
+						}
+						else
+						{
+							//string value = ResetTextValue(index, col).ToString();
+							string value = (isPrint ? ResetPrintTextValue(index, col) : ResetTextValue(index, col)).ToString();
+							LayoutUtility.DrawText(graphics,
+									GraphicsUnit.Millimeter,
+									rfM,
+									rf,
+									value,
+									col.FontDraw,
+									col.TextColor,
+									col.LineSpaceDraw,
+									col.CharacterSpaceDraw,
+									col.CharacterCount,
+									col.TextAlign,
+									col.TextAlignVertical,
+									col.Wrap,
+									col.Clip,
+									false);
+						}
+
+						lastLeft += col.WidthDraw + _lineWidthDraw;
+						if (lastLeft >= rectangle.Right)
+						{
+							break;
+						}
+					}
+					if (!hasColsWidth)
+					{
+						colsWidth = lastLeft;
+						hasColsWidth = true;
+					}
+					lastTop += _rowsHeightDraw + _lineWidthDraw;
+					index++;
+					if (lastTop >= rectangle.Bottom)
+					{
+						break;
+					}
+				}
+			}
+
+			rectangle.Width = (hasColsWidth ? colsWidth : lastLeft) - rectangle.Left;
+			rectangle.Height = lastTop - rectangle.Top;
+		}
+
+		/// <summary>
+		/// 格式化数据源中的值
+		/// </summary>
+		private string FormatDataValue(object dataValue, GridItemColumn gridColumn)
+		{
+			string result = null;
+			if (dataValue != null && dataValue != DBNull.Value)
+			{
+				if (gridColumn.ItemStyle == ItemStyle.Date)
+				{
+					result = dataValue.ToString();
+					DateTime dateTime;
+					if (DateTime.TryParse(result, out dateTime))
+					{
+						if (string.IsNullOrEmpty(gridColumn.Format))
+						{
+							result = dateTime.ToString(LayoutConsts.DATETIME_FRORMAT);
+						}
+						else
+						{
+							//if (LayoutConsts.CULTUREINFO_JP.Equals(gridColumn.Culture))
+							//{
+							//	result = dateTime.ToString(gridColumn.Format, LayoutCommon.CultureInfoJP);
+							//}
+							//else
+							{
+								// MMM
+								if (gridColumn.Format.Contains(LayoutConsts.DATETIME_FRORMAT_MMM))
+								{
+									if (string.IsNullOrEmpty(gridColumn.Culture))
+									{
+										result = dateTime.ToString(gridColumn.Format).ToUpper();
+									}
+									else
+									{
+										result = dateTime.ToString(gridColumn.Format,
+											System.Globalization.CultureInfo.CreateSpecificCulture(gridColumn.Culture)).ToUpper();
+									}
+								}
+								else if (string.IsNullOrEmpty(gridColumn.Culture))
+								{
+									result = dateTime.ToString(gridColumn.Format);
+								}
+								else
+								{
+									result = dateTime.ToString(gridColumn.Format,
+										System.Globalization.CultureInfo.CreateSpecificCulture(gridColumn.Culture));
+								}
+							}
+						}
+					}
+				}
+				else if (gridColumn.ItemStyle == ItemStyle.Sign)
+				{
+					if (string.IsNullOrEmpty(gridColumn.Format))
+					{
+						result = dataValue.ToString();
+					}
+					else
+					{
+						result = gridColumn.Format;
+					}
+				}
+				else
+				{
+					result = dataValue.ToString();
+				}
+			}
+			return result;
+		}
+
+		/// <summary>
+		/// 文本内容设置
+		/// </summary>
+		private object ResetTextValue(int index, GridItemColumn gridColumn)
+		{
+			//if (_owner == null)
+			//{
+			//	return gridColumn.DisplayValue;
+			//}
+			//if (_owner.LayoutMode == LayoutMode.Preview)
+			{
+				if (gridColumn.IsDataBinding)
+				{
+					//if (_gridSource != null && _gridSource.Columns.Contains(gridColumn.DataPropertyName)
+					//    && _gridSource.Rows.Count > 0 && index < _gridSource.Rows.Count)
+					if (this._dataView != null
+						&& this._dataView.Count > 0
+						&& index < this._dataView.Count
+						&& this._dataView.Table.Columns.Contains(gridColumn.DataPropertyName))
+					{
+						//object dataValue = _gridSource.Rows[index][gridColumn.DataPropertyName];
+						object dataValue = this._dataView[index][gridColumn.DataPropertyName];
+						object result = dataValue;//Owner.SetItemValueFormattingArgs(this, dataValue, gridColumn.Format);
+						if (gridColumn.PicColumn)
+						{
+							if (result != null && result is Image)
+							{
+								return result;
+							}
+							if (dataValue != null && dataValue is byte[])
+							{
+								System.IO.MemoryStream ms = new System.IO.MemoryStream(dataValue as byte[]);
+								return Image.FromStream(ms);
+							}
+							return dataValue;
+						}
+						if (result != null)
+						{
+							return result.ToString();
+						}
+						if (dataValue != null && dataValue != DBNull.Value)
+						{
+							return FormatDataValue(dataValue, gridColumn);
+						}
+						return gridColumn.DefaultValue;
+					}
+					return "";
+				}
+				return gridColumn.DisplayValue;
+			}
+			//else
+			//{
+			//	object result = _owner.SetItemValueFormattingArgs(this, gridColumn.DisplayValue, gridColumn.Format);
+			//	if (result != null)
+			//	{
+			//		return result.ToString();
+			//	}
+			//	return gridColumn.DisplayValue;
+			//}
+		}
+
+		///// <summary>
+		///// 初始化Item图形属性
+		///// </summary>
+		//internal override void SetShapeProperty(float zoom)
+		//{
+		//}
+
+		/// <summary>
+		/// 计算Grid总页数
+		/// </summary>
+		private void SetTotalPageNum()
+		{
+			int rowCount = this._displayRowCount;
+			//if (this._gridSource == null || this._gridSource.Rows.Count == 0 || rowCount < 1)
+			if (this._dataView == null || this._dataView.Count == 0 || rowCount < 1)
+			{
+				this._totalPageNum = 1;
+				return;
+			}
+
+			int dataCount = this._dataView.Count;
+			if (this._titleVisible)
+			{
+				if (this._alwaysTitleVisible)
+				{
+					rowCount--;
+				}
+				else
+				{
+					dataCount++;
+				}
+			}
+			if (rowCount == 0)
+			{
+				this._totalPageNum = 1;
+				return;
+			}
+			this._totalPageNum = (dataCount / rowCount) + ((dataCount % rowCount) == 0 ? 0 : 1);
+			//if (_owner != null)
+			//{
+			//	_owner.SetTotalPageNum();
+			//}
+		}
+
+		/// <summary>
+		/// 根据页码取得显示的行号
+		/// </summary>
+		/// <param name="pageNum"></param>
+		public int GetRowIndexByPageNum(int pageNum)
+		{
+			if (pageNum <= 1)
+			{
+				return 0;
+			}
+			if (pageNum > _totalPageNum)
+			{
+				return pageNum * _displayRowCount;
+			}
+			if (_titleVisible)
+			{
+				if (_alwaysTitleVisible)
+				{
+					return (pageNum - 1) * (_displayRowCount - 1);
+				}
+				return (pageNum - 1) * (_displayRowCount) - 1;
+			}
+			return (pageNum - 1) * (_displayRowCount);
+		}
+
+		#region 打印用
+		/// <summary>
+		/// 文本内容设置
+		/// </summary>
+		private object ResetPrintTextValue(int index, GridItemColumn gridColumn)
+		{
+			//if (_owner == null)
+			//{
+			//	return gridColumn.DisplayValue;
+			//}
+			//if (_owner.LayoutMode == LayoutMode.Preview)
+			{
+				if (gridColumn.IsDataBinding)
+				{
+					//if (_gridSource != null && _gridSource.Columns.Contains(gridColumn.DataPropertyName)
+					//    && _gridSource.Rows.Count > 0 && index < _gridSource.Rows.Count)
+					if (this._printDataView != null
+						&& this._printDataView.Count > 0
+						&& index < this._printDataView.Count
+						&& this._printDataView.Table.Columns.Contains(gridColumn.DataPropertyName))
+					{
+						//object dataValue = _gridSource.Rows[index][gridColumn.DataPropertyName];
+						object dataValue = this._printDataView[index][gridColumn.DataPropertyName];
+                        object result = dataValue;//Owner.SetItemValueFormattingArgs(this, dataValue, gridColumn.Format);
+                        if (gridColumn.PicColumn)
+						{
+							if (result != null && result is Image)
+							{
+								return result;
+							}
+							if (dataValue != null && dataValue is byte[])
+							{
+								System.IO.MemoryStream ms = new System.IO.MemoryStream(dataValue as byte[]);
+								return Image.FromStream(ms);
+							}
+							return dataValue;
+						}
+						if (result != null)
+						{
+							return result.ToString();
+						}
+						if (dataValue != null && dataValue != DBNull.Value)
+						{
+							return FormatDataValue(dataValue, gridColumn);
+						}
+						return gridColumn.DefaultValue;
+					}
+					return "";
+				}
+				return gridColumn.DisplayValue;
+            }
+            //else
+            //{
+            //	object result = _owner.SetItemValueFormattingArgs(this, gridColumn.DisplayValue, gridColumn.Format);
+            //	if (result != null)
+            //	{
+            //		return result.ToString();
+            //	}
+            //	return gridColumn.DisplayValue;
+            //}
+        }
+
+		/// <summary>
+		/// 计算Grid总页数
+		/// </summary>
+		private void SetPrintTotalPageNum()
+		{
+			int rowCount = this._displayRowCount;
+			//if (this._gridSource == null || this._gridSource.Rows.Count == 0 || rowCount < 1)
+			if (this._printDataView == null || this._printDataView.Count == 0 || rowCount < 1)
+			{
+				this._printTotalPageNum = 1;
+				return;
+			}
+
+			int dataCount = this._printDataView.Count;
+			if (this._titleVisible)
+			{
+				if (this._alwaysTitleVisible)
+				{
+					rowCount--;
+				}
+				else
+				{
+					dataCount++;
+				}
+			}
+			if (rowCount == 0)
+			{
+				this._printTotalPageNum = 1;
+				return;
+			}
+			this._printTotalPageNum = (dataCount / rowCount) + ((dataCount % rowCount) == 0 ? 0 : 1);
+			//if (_owner != null)
+			//{
+			//	_owner.SetPrintTotalPageNum();
+			//}
+		}
+
+		/// <summary>
+		/// 根据页码取得显示的行号
+		/// </summary>
+		/// <param name="pageNum"></param>
+		public int GetPrintRowIndexByPageNum(int pageNum)
+		{
+			if (pageNum <= 1)
+			{
+				return 0;
+			}
+			if (pageNum > _printTotalPageNum)
+			{
+				return pageNum * _displayRowCount;
+			}
+			if (_titleVisible)
+			{
+				if (_alwaysTitleVisible)
+				{
+					return (pageNum - 1) * (_displayRowCount - 1);
+				}
+				return (pageNum - 1) * (_displayRowCount) - 1;
+			}
+			return (pageNum - 1) * (_displayRowCount);
+		}
+		#endregion
+		#endregion 函数
+	}
+}

+ 953 - 0
DK.Service/InvoiceLayout/Items/DataGridItem/GridItemColumn.cs

@@ -0,0 +1,953 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:GridItemColumn.cs
+ *		2.功能描述:表格列
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class GridItemColumn
+	{
+		#region 成员变量
+		private int _id = -1;											// ColID
+		private string _name = string.Empty;				// 列名
+		private string _headerText = string.Empty;		// 标题文本
+		private int _displayIndex = -1;							// 列排序
+		private float _width = 0;									// 列宽
+		private string _dataPropertyName;					// 对应数据源中的字段名
+		private bool _isDataBinding;							// 是否数据绑定
+		private string _displayValue;							// 编辑模式显示的值
+		private ItemStyle _itemStyle;							// 格式类别
+		private string _format;									// 文本格式
+		// 列属性
+		private Font _font;											// 文本字体
+		private bool _isUnderline;								// 下划线
+		private bool _isStrikeout;								// 删除线
+		private bool _wrap;										// 是否自动换行
+		private bool _clip;											// 是否剪裁延伸到边框外侧的文本
+		private Color _textColor;									// 文本颜色
+		private TextAlignment _textAlign = TextAlignment.Center;// 文本对齐方式
+		private TextAlignment _textAlignVertical;				// 文本垂直对齐方式
+		private TextDirection _textDirection;					// 文本方向
+		private float _characterSpace;							// 文字间隔
+		private float _lineSpace;									// 文字行间隔
+		private int _characterCount;								// 行文字数
+		// 行头属性
+		private Font _fontHead;											// 文本字体
+		private bool _isUnderlineHead;								// 下划线
+		private bool _isStrikeoutHead;								// 删除线
+		private bool _wrapHead;										// 是否自动换行
+		private bool _clipHead;											// 是否剪裁延伸到边框外侧的文本
+		private Color _textColorHead;									// 文本颜色
+		private TextAlignment _textAlignHead;						// 文本对齐方式
+		private TextAlignment _textAlignVerticalHead;				// 文本垂直对齐方式
+		private TextDirection _textDirectionHead;					// 文本方向
+		private float _characterSpaceHead;							// 文字间隔
+		private float _lineSpaceHead;									// 文字行间隔
+		private int _characterCountHead;								// 行文字数
+
+		private string _defaultValue;							// 文本默认值
+		private string _culture;									// culture
+		private GridColumnState _columnState = GridColumnState.Detached;		// 列状态
+		private GridItem _gridItem;								// 表格Item
+		private GridItemColumnCollection _gridColumns;									// 表格列集合
+
+		[NonSerialized]
+		public float WidthDraw = 0;
+		[NonSerialized]
+		public Font FontDraw;
+		[NonSerialized]
+		public float CharacterSpaceDraw = 0;
+		[NonSerialized]
+		public float LineSpaceDraw = 0;
+		[NonSerialized]
+		public Font FontHeadDraw;
+		[NonSerialized]
+		public float CharacterSpaceHeadDraw = 0;
+		[NonSerialized]
+		public float LineSpaceHeadDraw = 0;
+		#endregion 成员变量
+
+		#region 属性
+		/// <summary>
+		/// 列ID
+		/// </summary>
+		public int ID
+		{
+			get
+			{
+				return _id;
+			}
+			internal set
+			{
+				_id = value;
+			}
+		}
+
+		/// <summary>
+		/// 列状态
+		/// </summary>
+		internal GridColumnState ColumnState
+		{
+			get
+			{
+				return _columnState;
+			}
+			set
+			{
+				_columnState = value;
+			}
+		}
+
+		/// <summary>
+		/// 列名
+		/// </summary>
+		public string Name
+		{
+			get { return this._name; }
+			set { this._name = value; }
+		}
+
+		/// <summary>
+		/// 标题文本
+		/// </summary>
+		public string HeaderText
+		{
+			get
+			{
+				return _headerText;
+			}
+			set
+			{
+				if (_headerText != value)
+				{
+					_headerText = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 列排序
+		/// </summary>
+		public int DisplayIndex
+		{
+			get
+			{
+				return _displayIndex;
+			}
+			set
+			{
+				if (_displayIndex < value)
+				{
+					if (_gridItem != null)
+					{
+						for (int i = _displayIndex; i < value; i++)
+						{
+							_gridItem.Columns[i].DisplayIndexInternal -= 1;
+						}
+						_displayIndex = value;
+						_gridItem.Columns.UpdateColumnsOrder();
+						//if (_gridItem.Owner != null)
+						//{
+						//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+						//}
+					}
+				}
+				else if (_displayIndex > value)
+				{
+					if (_gridItem != null)
+					{
+						for (int i = value; i < _displayIndex; i++)
+						{
+							_gridItem.Columns[i].DisplayIndexInternal += 1;
+						}
+						_displayIndex = value;
+						_gridItem.Columns.UpdateColumnsOrder();
+						//if (_gridItem.Owner != null)
+						//{
+						//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+						//}
+					}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 列排序
+		/// </summary>
+		internal int DisplayIndexInternal
+		{
+			get
+			{
+				return _displayIndex;
+			}
+			set
+			{
+				_displayIndex = value;
+			}
+		}
+
+		/// <summary>
+		/// 列宽(mm)
+		/// </summary>
+		public float Width
+		{
+			get
+			{
+				return _width;
+			}
+			set
+			{
+				if (_width != value)
+				{
+					_width = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 数据源属性或数据库列的名称
+		/// </summary>
+		public string DataPropertyName
+		{
+			get
+			{
+				return _dataPropertyName;
+			}
+			set
+			{
+				if (!value.Equals(_dataPropertyName))
+				{
+					_dataPropertyName = value;
+					_isDataBinding = !string.IsNullOrEmpty(_dataPropertyName);
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 是否数据绑定
+		/// </summary>
+		internal bool IsDataBinding
+		{
+			get
+			{
+				return _isDataBinding;
+			}
+		}
+
+		/// <summary>
+		/// 编辑模式显示的值
+		/// </summary>
+		public string DisplayValue
+		{
+			get
+			{
+				return _displayValue;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_displayValue))
+				{
+					_displayValue = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 格式类别
+		/// </summary>
+		public ItemStyle ItemStyle
+		{
+			get
+			{
+				return _itemStyle;
+			}
+			set
+			{
+				if (value != _itemStyle)
+				{
+					_itemStyle = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本格式
+		/// </summary>
+		public string Format
+		{
+			get
+			{
+				return _format;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_format))
+				{
+					_format = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本字体
+		/// </summary>
+		public Font Font
+		{
+			get
+			{
+				return _font;
+			}
+			set
+			{
+				if (!_font.Equals(value))
+				{
+					_font = value;
+					_isUnderline = _font.Underline;
+					_isStrikeout = _font.Strikeout;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 是否自动文本换行
+		/// </summary>
+		public bool Wrap
+		{
+			get
+			{
+				return _wrap;
+			}
+			set
+			{
+				if (_wrap != value)
+				{
+					_wrap = value;
+					_clip = !_wrap;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 是否剪裁延伸到边框外侧的文本
+		/// </summary>
+		internal bool Clip
+		{
+			get
+			{
+				_clip = !_wrap;
+				return _clip;
+			}
+		}
+
+		/// <summary>
+		/// 文本颜色
+		/// </summary>
+		public Color TextColor
+		{
+			get
+			{
+				return _textColor;
+			}
+			set
+			{
+				if (!_textColor.Equals(value))
+				{
+					_textColor = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本对齐方式
+		/// </summary>
+		public TextAlignment TextAlign
+		{
+			get
+			{
+				return _textAlign;
+			}
+			set
+			{
+				if (_textAlign != value)
+				{
+					_textAlign = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本垂直对齐方式
+		/// </summary>
+		public TextAlignment TextAlignVertical
+		{
+			get
+			{
+				return _textAlignVertical;
+			}
+			set
+			{
+				if (_textAlignVertical != value)
+				{
+					_textAlignVertical = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本方向
+		/// </summary>
+		public TextDirection TextDirection
+		{
+			get
+			{
+				return _textDirection;
+			}
+			set
+			{
+				if (_textDirection != value)
+				{
+					_textDirection = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文字间隔
+		/// </summary>
+		public float CharacterSpace
+		{
+			get
+			{
+				return _characterSpace;
+			}
+			set
+			{
+				if (_characterSpace != value)
+				{
+					_characterSpace = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文字行间隔
+		/// </summary>
+		public float LineSpace
+		{
+			get
+			{
+				return _lineSpace;
+			}
+			set
+			{
+				if (_lineSpace != value)
+				{
+					_lineSpace = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 行文字数
+		/// </summary>
+		public int CharacterCount
+		{
+			get
+			{
+				return _characterCount;
+			}
+			set
+			{
+				if (_characterCount != value)
+				{
+					_characterCount = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 表头文本字体
+		/// </summary>
+		public Font FontHead
+		{
+			get
+			{
+				if (_fontHead == null)
+				{
+					//_fontHead = LayoutCommon.DefaultItemFont;
+					_textColorHead = Color.Black;
+					_textAlignHead = TextAlignment.Center;
+				}
+				return _fontHead;
+			}
+			set
+			{
+				if (_fontHead == null)
+				{
+					//_fontHead = LayoutCommon.DefaultItemFont;
+					_textColorHead = Color.Black;
+					_textAlignHead = TextAlignment.Center;
+				}
+				if (!_fontHead.Equals(value))
+				{
+					_fontHead = value;
+					_isUnderlineHead = _fontHead.Underline;
+					_isStrikeoutHead = _fontHead.Strikeout;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 是否自动表头文本换行
+		/// </summary>
+		public bool WrapHead
+		{
+			get
+			{
+				return _wrapHead;
+			}
+			set
+			{
+				if (_wrapHead != value)
+				{
+					_wrapHead = value;
+					_clipHead = !_wrapHead;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 是否剪裁延伸到边框外侧的表头文本
+		/// </summary>
+		internal bool ClipHead
+		{
+			get
+			{
+				_clipHead = !_wrapHead;
+				return _clipHead;
+			}
+		}
+
+		/// <summary>
+		/// 表头文本颜色
+		/// </summary>
+		public Color TextColorHead
+		{
+			get
+			{
+				return _textColorHead;
+			}
+			set
+			{
+				if (!_textColorHead.Equals(value))
+				{
+					_textColorHead = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 表头文本对齐方式
+		/// </summary>
+		public TextAlignment TextAlignHead
+		{
+			get
+			{
+				return _textAlignHead;
+			}
+			set
+			{
+				if (_textAlignHead != value)
+				{
+					_textAlignHead = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 表头文本垂直对齐方式
+		/// </summary>
+		public TextAlignment TextAlignVerticalHead
+		{
+			get
+			{
+				return _textAlignVerticalHead;
+			}
+			set
+			{
+				if (_textAlignVerticalHead != value)
+				{
+					_textAlignVerticalHead = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 表头文本方向
+		/// </summary>
+		public TextDirection TextDirectionHead
+		{
+			get
+			{
+				return _textDirectionHead;
+			}
+			set
+			{
+				if (_textDirectionHead != value)
+				{
+					_textDirectionHead = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 表头文字间隔
+		/// </summary>
+		public float CharacterSpaceHead
+		{
+			get
+			{
+				return _characterSpaceHead;
+			}
+			set
+			{
+				if (_characterSpaceHead != value)
+				{
+					_characterSpaceHead = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 表头文字行间隔
+		/// </summary>
+		public float LineSpaceHead
+		{
+			get
+			{
+				return _lineSpaceHead;
+			}
+			set
+			{
+				if (_lineSpaceHead != value)
+				{
+					_lineSpaceHead = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 表头行文字数
+		/// </summary>
+		public int CharacterCountHead
+		{
+			get
+			{
+				return _characterCountHead;
+			}
+			set
+			{
+				if (_characterCountHead != value)
+				{
+					_characterCountHead = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本默认值
+		/// </summary>
+		public string DefaultValue
+		{
+			get
+			{
+				return _defaultValue;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_defaultValue))
+				{
+					_defaultValue = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// culture
+		/// </summary>
+		public string Culture
+		{
+			get
+			{
+				return _culture;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_culture))
+				{
+					_culture = value;
+					//if (_gridItem != null && _gridItem.Owner != null)
+					//{
+					//	_gridItem.Owner.SetItemChangedArgs(_gridItem, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 表格Item
+		/// </summary>
+		public GridItem GridItem
+		{
+			get
+			{
+				return _gridItem;
+			}
+			internal set
+			{
+				_gridItem = value;
+			}
+		}
+
+		/// <summary>
+		/// 表格列集合
+		/// </summary>
+		public GridItemColumnCollection Columns
+		{
+			 get
+			{
+				return _gridColumns;
+			}
+			internal set
+			{
+				_gridColumns = value;
+			}
+		}
+
+		public bool PicColumn
+		{
+			get;
+			set;
+		}
+		public bool PicMargin
+		{
+			get;
+			set;
+		}
+		public bool FixedRatio
+		{
+			get;
+			set;
+		}
+		#endregion 属性
+
+		#region 构造函数
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		/// <param name="name">列名</param>
+		/// <param name="headerText">标题文本</param>
+		public GridItemColumn(string name, string headerText)
+		{
+			_name = name;
+			_headerText = headerText;
+			//_fontHead = LayoutCommon.DefaultItemFont;
+			_textColorHead = Color.Black;
+			_textAlignHead = TextAlignment.Center;
+			_characterSpaceHead = 0f;
+			_lineSpaceHead = 0f;
+			_characterCountHead = 0;
+			//_font = LayoutCommon.DefaultItemFont;
+			//_width = LayoutCommon.DefaultTextItemSizeWidth;
+			_displayValue = string.Empty;
+			_format = string.Empty;
+			_defaultValue = string.Empty;
+			_textColor = Color.Black;
+			_textAlign = TextAlignment.LeftOrTop;
+			_characterSpace = 0f;
+			_lineSpace = 0f;
+			_characterCount = 0;
+			_itemStyle = ItemStyle.Other;
+		}
+
+		private GridItemColumn()
+		{
+		}
+		#endregion 构造函数
+
+		#region 函数
+		/// <summary>
+		/// 根据当前列创建一个新列
+		/// </summary>
+		/// <returns>一个新列</returns>
+		public virtual GridItemColumn CopyTo()
+		{
+			GridItemColumn gic = new GridItemColumn();
+			gic._id = _id;
+			gic._name = _name;
+			gic._headerText = _headerText;
+			gic._displayIndex = _displayIndex;
+			gic._width = _width;
+			gic._dataPropertyName = _dataPropertyName;
+			gic._isDataBinding = _isDataBinding;
+
+			gic._fontHead = (Font)_fontHead.Clone();
+			gic._wrapHead = _wrapHead;
+			gic._isUnderlineHead = _isUnderlineHead;
+			gic._isStrikeoutHead = _isStrikeoutHead;
+			gic._textColorHead = _textColorHead;
+			gic._textAlignHead = _textAlignHead;
+			gic._textAlignVerticalHead = _textAlignVerticalHead;
+			gic._textDirectionHead = _textDirectionHead;
+			gic._characterSpaceHead = _characterSpaceHead;
+			gic._lineSpaceHead = _lineSpaceHead;
+			gic._characterCountHead = _characterCountHead;
+
+			gic._font = (Font)_font.Clone();
+			gic._wrap = _wrap;
+			gic._displayValue = _displayValue;
+			gic._format = _format;
+			gic._isUnderline = _isUnderline;
+			gic._isStrikeout = _isStrikeout;
+			gic._defaultValue = _defaultValue;
+			gic._textColor = _textColor;
+			gic._textAlign = _textAlign;
+			gic._textAlignVertical = _textAlignVertical;
+			gic._textDirection = _textDirection;
+			gic._characterSpace = _characterSpace;
+			gic._lineSpace = _lineSpace;
+			gic._characterCount = _characterCount;
+			gic._itemStyle = _itemStyle;
+			gic._culture = _culture;
+			gic.PicMargin = PicMargin;
+			gic.FixedRatio = FixedRatio;
+			gic.PicColumn = PicColumn;
+			return gic;
+		}
+		#endregion 函数
+	}
+}

+ 554 - 0
DK.Service/InvoiceLayout/Items/DataGridItem/GridItemColumnCollection.cs

@@ -0,0 +1,554 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:GridItemColumnCollection.cs
+ *		2.功能描述:表格列集合
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[ListBindable(false)]
+	[Serializable]
+	public class GridItemColumnCollection : IList, ICollection, IEnumerable
+	{
+		#region 成员变量
+		// 列集合排序比较器
+		[NonSerialized]
+		private static ColumnOrderComparer _columnOrderComparer = new ColumnOrderComparer();
+		 [NonSerialized]
+		public static string DisplayMember = "HeaderText";
+		[NonSerialized]
+		public static string DefaultColName = "Column";
+		// 表格Item
+		private GridItem _gridItem;
+		// 新列的ID,自增
+		private int _newColID = 0;
+		// 列集合
+		private ArrayList _items = new ArrayList();
+		#endregion 成员变量
+
+		#region 属性
+		/// <summary>
+		/// 生成新的列ID
+		/// </summary>
+		internal int NewColID
+		{
+			get
+			{
+				return _newColID++;
+			}
+		}
+
+		/// <summary>
+		/// 表格Item
+		/// </summary>
+		public GridItem GridItem
+		{
+			get
+			{
+				return this._gridItem;
+			}
+			internal set
+			{
+				_gridItem = value;
+				foreach (GridItemColumn item in this)
+				{
+					item.GridItem = _gridItem;
+				}
+			}
+		}
+
+		/// <summary>
+		/// 列集合排序比较器
+		/// </summary>
+		internal static IComparer ColumnCollectionOrderComparer
+		{
+			get
+			{
+				return _columnOrderComparer;
+			}
+		}
+		#endregion 属性
+
+		#region 内部类
+		private class ColumnOrderComparer : IComparer
+		{
+			public int Compare(object x, object y)
+			{
+				GridItemColumn column = x as GridItemColumn;
+				GridItemColumn column2 = y as GridItemColumn;
+				return (column.DisplayIndex - column2.DisplayIndex);
+			}
+		}
+		#endregion 内部类
+
+		#region 构造函数
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		public GridItemColumnCollection(GridItem gridItem)
+		{
+			this._gridItem = gridItem;
+		}
+
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		private GridItemColumnCollection()
+		{
+		}
+		#endregion 构造函数
+
+		#region 函数
+		/// <summary>
+		/// 根据当前列集合创建一个新列集合
+		/// </summary>
+		/// <returns>一个新列集合</returns>
+		public virtual GridItemColumnCollection CopyTo()
+		{
+			GridItemColumnCollection gicc = new GridItemColumnCollection();
+			gicc._newColID = _newColID;
+			gicc._gridItem = _gridItem;
+			foreach (GridItemColumn gic in _items)
+			{
+				GridItemColumn gic1 = gic.CopyTo();
+				gic1.Columns = gicc;
+				gicc._items.Add(gic1);
+			}
+			return gicc;
+		}
+
+		#region 列操作
+		/// <summary>
+		/// 追加一个新列
+		/// </summary>
+		/// <param name="gridItemColumn">新列</param>
+		/// <returns>排位</returns>
+		public virtual int Add(GridItemColumn gridItemColumn)
+		{
+			if (gridItemColumn == null)
+			{
+				throw new ArgumentNullException("gridItemColumn");
+			}
+			if (gridItemColumn.ColumnState != GridColumnState.Detached)
+			{
+				if (this.Contains(gridItemColumn))
+				{
+					throw new Exception("column has been in the collection");
+				}
+			}
+			if (this.Contains(gridItemColumn.Name))
+			{
+				throw new Exception("the column name already exists in the collection");
+			}
+
+			int num = this._items.Add(gridItemColumn);
+			gridItemColumn.DisplayIndexInternal = num;
+			gridItemColumn.GridItem = this._gridItem;
+			gridItemColumn.Columns = this;
+			//if (this._gridItem.Owner != null)
+			//{
+			//	gridItemColumn.ID = this._gridItem.Owner.NewItemID;
+			//}
+			gridItemColumn.ColumnState = GridColumnState.Unchanged;
+			this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, gridItemColumn), false, num);
+			return num;
+		}
+
+		/// <summary>
+		/// 追加一个新列
+		/// </summary>
+		/// <param name="columnName">列名</param>
+		/// <param name="headerText">标题文本</param>
+		/// <returns>排位</returns>
+		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+		public virtual int Add(string columnName, string headerText)
+		{
+			GridItemColumn gridItemColumn = new GridItemColumn(columnName, headerText);
+			return this.Add(gridItemColumn);
+		}
+
+		/// <summary>
+		/// 插入一个新列
+		/// </summary>
+		/// <param name="columnIndex">插入位置</param>
+		/// <param name="gridItemColumn">新列</param>
+		public virtual void Insert(int columnIndex, GridItemColumn gridItemColumn)
+		{
+			if (gridItemColumn == null)
+			{
+				throw new ArgumentNullException("gridItemColumn");
+			}
+			if (gridItemColumn.ColumnState != GridColumnState.Detached)
+			{
+				if (this.Contains(gridItemColumn))
+				{
+					throw new Exception("column has been in the collection");
+				}
+			}
+			if (this.Contains(gridItemColumn.Name))
+			{
+				throw new Exception("the column name already exists in the collection");
+			}
+
+			this._items.Insert(columnIndex, gridItemColumn);
+			gridItemColumn.DisplayIndexInternal = columnIndex;
+			gridItemColumn.GridItem = this._gridItem;
+			gridItemColumn.Columns = this;
+			//gridItemColumn.ID = this._gridItem.Owner.NewItemID;
+			gridItemColumn.ColumnState = GridColumnState.Unchanged;
+			this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, gridItemColumn), true, columnIndex);
+		}
+
+		/// <summary>
+		/// 移除一列
+		/// </summary>
+		/// <param name="columnName">列名</param>
+		/// <returns>是否成功。true:成功;false:失败</returns>
+		public virtual bool Remove(string columnName)
+		{
+			if (columnName == null)
+			{
+				throw new ArgumentNullException("columnName");
+			}
+			int count = this._items.Count;
+			for (int i = 0; i < count; i++)
+			{
+				GridItemColumn column = (GridItemColumn)this._items[i];
+				if (string.Compare(column.Name, columnName, true, CultureInfo.InvariantCulture) == 0)
+				{
+					return this.RemoveAt(i);
+				}
+			}
+			return false;
+		}
+
+		/// <summary>
+		/// 移除一列
+		/// </summary>
+		/// <param name="index">列位置</param>
+		/// <returns>是否成功。true:成功;false:失败</returns>
+		public virtual bool RemoveAt(int index)
+		{
+			if ((index < 0) || (index >= this.Count))
+			{
+				return false;
+			}
+			return this.RemoveAtInternal(index, false);
+		}
+
+		/// <summary>
+		/// 移除一列
+		/// </summary>
+		/// <param name="colID">列ID</param>
+		/// <returns>是否成功。true:成功;false:失败</returns>
+		public virtual bool RemoveAtByID(int colID)
+		{
+			int count = this._items.Count;
+			for (int i = 0; i < count; i++)
+			{
+				GridItemColumn column = (GridItemColumn)this._items[i];
+				if (colID == column.ID)
+				{
+					return this.RemoveAt(i);
+				}
+			}
+			return false;
+		}
+
+		/// <summary>
+		/// 移除一列
+		/// </summary>
+		/// <param name="index">列位置</param>
+		/// <param name="force"></param>
+		/// <returns>是否成功。true:成功;false:失败</returns>
+		internal bool RemoveAtInternal(int index, bool force)
+		{
+			GridItemColumn gridItemColumn = (GridItemColumn)this._items[index];
+			this._items.RemoveAt(index);
+			gridItemColumn.GridItem = null;
+			gridItemColumn.Columns = null;
+			gridItemColumn.ColumnState = GridColumnState.Detached;
+			this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, gridItemColumn), false, index);
+			return true;
+		}
+
+		/// <summary>
+		/// 清除列集合
+		/// </summary>
+		public virtual void Clear()
+		{
+			if (this.Count > 0)
+			{
+				for (int i = 0; i < this.Count; i++)
+				{
+					GridItemColumn column = this[i];
+					column.GridItem = null;
+					column.Columns = null;
+					column.ColumnState = GridColumnState.Detached;;
+				}
+				this._items.Clear();
+				this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Refresh, null), false, -1);
+			}
+		}
+
+		/// <summary>
+		/// 列集合中是否包含此列名
+		/// </summary>
+		/// <param name="columnName">列名</param>
+		/// <returns>是否包含。true:包含;false:不包含</returns>
+		public virtual bool Contains(string columnName)
+		{
+			if (columnName == null)
+			{
+				throw new ArgumentNullException("columnName");
+			}
+			int count = this._items.Count;
+			for (int i = 0; i < count; i++)
+			{
+				GridItemColumn column = (GridItemColumn)this._items[i];
+				if (string.Compare(column.Name, columnName, true, CultureInfo.InvariantCulture) == 0)
+				{
+					return true;
+				}
+			}
+			return false;
+		}
+
+		/// <summary>
+		/// 列集合中是否包含此列
+		/// </summary>
+		/// <param name="dataGridViewColumn">列</param>
+		/// <returns>是否包含。true:包含;false:不包含</returns>
+		public virtual bool Contains(GridItemColumn dataGridViewColumn)
+		{
+			return (this._items.IndexOf(dataGridViewColumn) != -1);
+		}
+
+		/// <summary>
+		/// 列集合中是否包含此ID的列
+		/// </summary>
+		/// <param name="colID">列ID</param>
+		/// <returns>是否包含。true:包含;false:不包含</returns>
+		public virtual bool Contains(int colID)
+		{
+			if (colID < 1)
+			{
+				return false;
+			}
+			int count = this._items.Count;
+			for (int i = 0; i < count; i++)
+			{
+				GridItemColumn column = (GridItemColumn)this._items[i];
+				if (colID == column.ID)
+				{
+					return true;
+				}
+			}
+			return false;
+		}
+
+		/// <summary>
+		/// 排序列
+		/// </summary>
+		internal void UpdateColumnsOrder()
+		{
+			if (this._items.Count > 1)
+			{
+				this._items.Sort(_columnOrderComparer);
+			}
+		}
+
+		/// <summary>
+		/// 根据列名获取列
+		/// </summary>
+		/// <param name="columnName">列名</param>
+		/// <returns>列</returns>
+		public GridItemColumn this[string columnName]
+		{
+			get
+			{
+				if (columnName == null)
+				{
+					throw new ArgumentNullException("columnName");
+				}
+				int count = this._items.Count;
+				for (int i = 0; i < count; i++)
+				{
+					GridItemColumn column = (GridItemColumn)this._items[i];
+					if (string.Equals(column.Name, columnName, StringComparison.OrdinalIgnoreCase))
+					{
+						return column;
+					}
+				}
+				return null;
+			}
+		}
+
+		/// <summary>
+		/// 根据索引获取列
+		/// </summary>
+		/// <param name="columnName">索引</param>
+		/// <returns>列</returns>
+		public GridItemColumn this[int index]
+		{
+			get
+			{
+				return (GridItemColumn)this._items[index];
+			}
+		}
+
+		/// <summary>
+		/// 集合中的元素个数
+		/// </summary>
+		public virtual int Count
+		{
+			get
+			{
+				return this._items.Count;
+			}
+		}
+
+		/// <summary>
+		/// 集合元素改变事件
+		/// </summary>
+		/// <param name="ccea"></param>
+		/// <param name="changeIsInsertion"></param>
+		/// <param name="index"></param>
+		private void OnCollectionChanged(CollectionChangeEventArgs ccea, bool changeIsInsertion, int index)
+		{
+			if (changeIsInsertion || ccea.Action == CollectionChangeAction.Remove)
+			{
+				for (int i = index; i < _items.Count; i++)
+				{
+					this[i].DisplayIndex = i;
+				}
+			}
+		}
+
+		public string GeNewColumnName()
+		{
+			// 生成列名
+			string colName;
+			int index = 0;
+			while (true)
+			{
+				colName = GridItemColumnCollection.DefaultColName + (++index);
+				if (!this.Contains(colName))
+				{
+					break;
+				}
+			}
+			return colName;
+		}
+		#endregion 列操作
+
+		#region 接口实现
+		void ICollection.CopyTo(Array array, int index)
+		{
+			this._items.CopyTo(array, index);
+		}
+
+		IEnumerator IEnumerable.GetEnumerator()
+		{
+			return this._items.GetEnumerator();
+		}
+
+		int IList.Add(object value)
+		{
+			return this.Add((GridItemColumn)value);
+		}
+
+		void IList.Clear()
+		{
+			this.Clear();
+		}
+
+		bool IList.Contains(object value)
+		{
+			return this._items.Contains(value);
+		}
+
+		int IList.IndexOf(object value)
+		{
+			return this._items.IndexOf(value);
+		}
+
+		void IList.Insert(int index, object value)
+		{
+			this.Insert(index, (GridItemColumn)value);
+		}
+
+		void IList.Remove(object value)
+		{
+			this.Remove(((GridItemColumn)value).Name);
+		}
+
+		void IList.RemoveAt(int index)
+		{
+			this.RemoveAt(index);
+		}
+
+		bool ICollection.IsSynchronized
+		{
+			get
+			{
+				return false;
+			}
+		}
+
+		object ICollection.SyncRoot
+		{
+			get
+			{
+				return this;
+			}
+		}
+
+		bool IList.IsFixedSize
+		{
+			get
+			{
+				return false;
+			}
+		}
+
+		bool IList.IsReadOnly
+		{
+			get
+			{
+				return false;
+			}
+		}
+
+		object IList.this[int index]
+		{
+			get
+			{
+				return this[index];
+			}
+			set
+			{
+				throw new NotSupportedException();
+			}
+		}
+
+		protected virtual ArrayList List
+		{
+			get
+			{
+				return this._items;
+			}
+		}
+		#endregion 接口实现
+		#endregion 函数
+	}
+}
+

+ 410 - 0
DK.Service/InvoiceLayout/Items/DataGridItem/PageNumItem.cs

@@ -0,0 +1,410 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:PageNumItem.cs
+ *		2.功能描述:页码Item
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class PageNumItem : LayoutItem
+	{
+		#region 成员变量
+		private string _displayValue;					// 编辑模式显示的值
+		private string _format;							// 文本格式
+		private Font _font;									// 文本字体
+		private Color _textColor;							// 文本颜色
+		private TextAlignment _textAlign;				// 文本对齐
+		private TextAlignment _textAlignVertical;		// 文本垂直对齐
+
+		[NonSerialized]
+		private Font _fontDraw;							// 绘制字体
+		[NonSerialized]
+		protected RectangleF _marginRectangleFDraw;    // 绘制范围
+		#endregion 成员变量
+
+		#region 属性
+		/// <summary>
+		/// 编辑模式显示的值
+		/// </summary>
+		public string DisplayValue
+		{
+			get
+			{
+				return _displayValue;
+			}
+		}
+
+		/// <summary>
+		/// 文本格式
+		/// </summary>
+		public string Format
+		{
+			get
+			{
+				return _format;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_format))
+				{
+					_format = value;
+					if (string.IsNullOrEmpty(_format))
+					{
+						this._displayValue = "";
+					}
+					else
+					{
+						this._displayValue = _format.Replace("&[页码]", "1").Replace("&[总页数]", "1");
+					}
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本字体
+		/// </summary>
+		public Font Font
+		{
+			get
+			{
+				return _font;
+			}
+			set
+			{
+				if (!_font.Equals(value))
+				{
+					_font = value;
+					float zoom = 100f;
+					//if (Owner != null)
+					//{
+					//	zoom = Owner.Zoom / 100.0f;
+					//}
+					if (0 < zoom)
+					{
+						_fontDraw = new Font(_font.FontFamily, _font.Size * zoom, _font.Style & (FontStyle.Regular | FontStyle.Bold | FontStyle.Italic));
+					}
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本颜色
+		/// </summary>
+		public Color TextColor
+		{
+			get
+			{
+				return _textColor;
+			}
+			set
+			{
+				if (!_textColor.Equals(value))
+				{
+					_textColor = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本对齐方式
+		/// </summary>
+		public TextAlignment TextAlign
+		{
+			get
+			{
+				return _textAlign;
+			}
+			set
+			{
+				if (_textAlign != value)
+				{
+					_textAlign = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本垂直对齐方式
+		/// </summary>
+		public TextAlignment TextAlignVertical
+		{
+			get
+			{
+				return _textAlignVertical;
+			}
+			set
+			{
+				if (_textAlignVertical != value)
+				{
+					_textAlignVertical = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 绘制字体
+		/// </summary>
+		internal Font FontDraw
+		{
+			get
+			{
+				return _fontDraw;
+			}
+		}
+
+        ///// <summary>
+        ///// 文本
+        ///// </summary>
+        //internal string Text
+        //{
+        //	get
+        //	{
+        //		//if (Owner == null)
+        //		//{
+        //		//	return _displayValue;
+        //		//}
+        //		//if (Owner.LayoutMode == LayoutMode.Preview)
+        //		{
+        //			if (string.IsNullOrEmpty(_format))
+        //			{
+        //				return "";
+        //			}
+        //			else
+        //			{
+        //				//return _format.Replace("&[页码]", Owner.CurrentPageNum.ToString())
+        //				//	.Replace("&[总页数]", Owner.TotalPageNum.ToString());
+        //			}
+        //		}
+        //		//else
+        //		//{
+        //		//	return _displayValue;
+        //		//}
+        //	}
+        //}
+
+        public string GetPrintText(int PrintPageNum, int PrintTotalPageNum)
+        {
+            if (string.IsNullOrEmpty(_format))
+            {
+                return "";
+            }
+            else
+            {
+                return _format.Replace("&[页码]", PrintPageNum.ToString())
+                    .Replace("&[总页数]", PrintTotalPageNum.ToString());
+            }
+        }
+
+        //      /// <summary>
+        //      /// 绘制文本
+        //      /// </summary>
+        //      internal string PrintText
+        //{
+        //	get
+        //	{
+        //		//if (Owner == null)
+        //		//{
+        //		//	return _displayValue;
+        //		//}
+        //		//if (Owner.LayoutMode == LayoutMode.Preview)
+        //		{
+        //			if (string.IsNullOrEmpty(_format))
+        //			{
+        //				return "";
+        //			}
+        //			else
+        //			{
+        //				//return _format.Replace("&[页码]", Owner.PrintPageNum.ToString())
+        //				//	.Replace("&[总页数]", Owner.PrintTotalPageNum.ToString());
+        //			}
+        //		}
+        //		//else
+        //		//{
+        //		//	return _displayValue;
+        //		//}
+        //	}
+        //}
+        #endregion 属性
+
+        #region 构造函数
+        ///// <summary>
+        ///// 构造函数
+        ///// </summary>
+        //internal PageNumItem()
+        //	: this(null)
+        //{
+        //}
+
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        internal PageNumItem(/*LayoutBox box*/)
+			: base(/*box, */ItemType.PageNum)
+		{
+			//_width = LayoutCommon.DefaultTextItemSizeWidth;
+			//_height = LayoutCommon.DefaultTextItemSizeHeight;
+			//_displayValue = string.Empty;
+			//_format = string.Empty;
+			//_font = LayoutCommon.DefaultItemFont;
+			_textColor = Color.Black;
+			_format = "&[页码]/&[总页数]";
+			_displayValue = "1/1";
+		}
+		#endregion 构造函数
+
+		#region 函数
+		///// <summary>
+		///// 显示Item属性设置画面
+		///// </summary>
+		///// <returns>
+		///// DialogResult.OK:选中的Item有效,设置成功<br/>
+		///// DialogResult.Cancel:选中的Item有效,取消设置<br/>
+		///// DialogResult.None:LayoutBox不是编辑模式,或选中的Item不是一个
+		///// </returns>
+		//protected override DialogResult ShowItemPropertyDialogInner()
+		//{
+		//	using (PageNumItemSetting itemPropertySetting = new PageNumItemSetting())
+		//	{
+		//		itemPropertySetting.TextLocationX = Left;
+		//		itemPropertySetting.TextLocationY = Top;
+		//		itemPropertySetting.TextWidth = Width;
+		//		itemPropertySetting.TextHeight = Height;
+		//		itemPropertySetting.TextAlign = TextAlign;
+		//		itemPropertySetting.TextAlignVertical = TextAlignVertical;
+		//		itemPropertySetting.TextColor = TextColor;
+		//		itemPropertySetting.TextFormat = Format;
+		//		itemPropertySetting.TextFont = Font;
+		//		DialogResult result = itemPropertySetting.ShowDialog();
+		//		if (result == DialogResult.OK)
+		//		{
+		//			Left = itemPropertySetting.TextLocationX;
+		//			Top = itemPropertySetting.TextLocationY;
+		//			Width = itemPropertySetting.TextWidth;
+		//			Height = itemPropertySetting.TextHeight;
+		//			Font = itemPropertySetting.TextFont;
+		//			TextAlign = itemPropertySetting.TextAlign;
+		//			TextAlignVertical = itemPropertySetting.TextAlignVertical;
+		//			TextColor = itemPropertySetting.TextColor;
+		//			Format = itemPropertySetting.TextFormat;
+		//			ResetItemFrame();
+		//			SetDrawProperty();
+		//			Owner.Dirty = true;
+		//		}
+		//		return result;
+		//	}
+		//}
+
+		/// <summary>
+		/// Item初始化
+		/// </summary>
+		/// <param name="box">LayoutBox</param>
+		/// <param name="isNewID">是否生成新ID</param>
+		/// <returns>是否成功</returns>
+		internal override bool Init(/*LayoutBox box, bool isNewID*/)
+		{
+			//if (_fontDraw == null)
+			//{
+			//	if (_font == null)
+			//	{
+			//		_font = LayoutCommon.DefaultItemFont;
+			//		_fontDraw = LayoutCommon.DefaultItemFont;
+			//	}
+			//	else
+			//	{
+			//		_fontDraw = new Font(_font.FontFamily, _font.Size, _font.Style & (FontStyle.Regular | FontStyle.Bold | FontStyle.Italic));
+			//	}
+			//}
+
+			bool isInit = base.Init(/*box, isNewID*/);
+			return isInit;
+		}
+
+		///// <summary>
+		///// 初始化Item绘制用属性
+		///// </summary>
+		//internal override float SetDrawProperty()
+		//{
+		//	float zoom = base.SetDrawProperty();
+		//	_fontDraw = new Font(_font.FontFamily, _font.Size * zoom, _fontDraw.Style);
+
+		//	_marginRectangleFDraw = new RectangleF();
+		//	_marginRectangleFDraw.X = (Left + LayoutConsts.TEXT_MARGIN) * zoom;
+		//	_marginRectangleFDraw.Y = (Top + LayoutConsts.TEXT_MARGIN) * zoom;
+		//	_marginRectangleFDraw.Width = (Width - LayoutConsts.TEXT_MARGIN - LayoutConsts.TEXT_MARGIN) * zoom;
+		//	_marginRectangleFDraw.Height = (Height - LayoutConsts.TEXT_MARGIN - LayoutConsts.TEXT_MARGIN) * zoom;
+		//	return zoom;
+		//}
+
+		///// <summary>
+		///// 初始化Item绘制用属性
+		///// </summary>
+		//internal override float SetRectangleF()
+		//{
+		//	float zoom = base.SetRectangleF();
+
+		//	_marginRectangleFDraw = new RectangleF();
+		//	_marginRectangleFDraw.X = (Left + LayoutConsts.TEXT_MARGIN) * zoom;
+		//	_marginRectangleFDraw.Y = (Top + LayoutConsts.TEXT_MARGIN) * zoom;
+		//	_marginRectangleFDraw.Width = (Width - LayoutConsts.TEXT_MARGIN - LayoutConsts.TEXT_MARGIN) * zoom;
+		//	_marginRectangleFDraw.Height = (Height - LayoutConsts.TEXT_MARGIN - LayoutConsts.TEXT_MARGIN) * zoom;
+
+		//	return zoom;
+		//}
+
+		///// <summary>
+		///// Item图形上的OnPaint事件
+		///// </summary>
+		///// <param name="sender">指定的对象</param>
+		///// <param name="e">提供的事件数据</param>
+		//protected override void OnPaint(object sender, PaintEventArgs e)
+		//{
+		//	LayoutUtility.DrawText(e.Graphics,
+		//							GraphicsUnit.Millimeter,
+		//							RectangleFDraw,
+		//							_marginRectangleFDraw,
+		//							Text,
+		//							_fontDraw,
+		//							_textColor,
+		//							0,
+		//							0,
+		//							0,
+		//							_textAlign,
+		//							_textAlignVertical,
+		//							false,
+		//							false,
+		//							Selected);
+		//}
+		#endregion 函数
+	}
+}

+ 351 - 0
DK.Service/InvoiceLayout/Items/DataGridItem/TotalTextItem.cs

@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:TotalTextItem.cs
+ *		2.功能描述:合计文本Item
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class TotalTextItem : TextItem, IBoundItem
+	{
+		#region 成员变量
+		private string _notTotalValue;					// 非合计页显示的值
+		private Font _notTotalFont;						// 文本字体
+		private Color _notTotalColor;					// 文本颜色
+		private TextAlignment _notTotalAlign;			// 文本对齐
+		private TextAlignment _notTotalAlignVertical;	// 文本垂直对齐
+
+		[NonSerialized]
+		private Font _notTotalFontDraw;					// 绘制字体
+		#endregion 成员变量
+
+		#region 属性
+		/// <summary>
+		/// 非合计页显示的值
+		/// </summary>
+		public string NotTotalValue
+		{
+			get
+			{
+				return _notTotalValue;
+			}
+			set
+			{
+				_notTotalValue = value;
+			}
+		}
+
+		/// <summary>
+		/// 文本字体
+		/// </summary>
+		public Font NotTotalFont
+		{
+			get
+			{
+				return _notTotalFont;
+			}
+			set
+			{
+				if (!_notTotalFont.Equals(value))
+				{
+					_notTotalFont = value;
+					float zoom = 100f;
+					//if (Owner != null)
+					//{
+					//	zoom = Owner.Zoom / 100.0f;
+					//}
+					if (0 < zoom)
+					{
+						_notTotalFontDraw = new Font(_notTotalFont.FontFamily, _notTotalFont.Size * zoom,
+							_notTotalFont.Style & (FontStyle.Regular | FontStyle.Bold | FontStyle.Italic));
+					}
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本颜色
+		/// </summary>
+		public Color NotTotalColor
+		{
+			get
+			{
+				return _notTotalColor;
+			}
+			set
+			{
+				if (!_notTotalColor.Equals(value))
+				{
+					_notTotalColor = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本对齐方式
+		/// </summary>
+		public TextAlignment NotTotalAlign
+		{
+			get
+			{
+				return _notTotalAlign;
+			}
+			set
+			{
+				if (_notTotalAlign != value)
+				{
+					_notTotalAlign = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本垂直对齐方式
+		/// </summary>
+		public TextAlignment NotTotalAlignVertical
+		{
+			get
+			{
+				return _notTotalAlignVertical;
+			}
+			set
+			{
+				if (_notTotalAlignVertical != value)
+				{
+					_notTotalAlignVertical = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 绘制字体
+		/// </summary>
+		internal Font NotTotalFontDraw
+		{
+			get
+			{
+				return _notTotalFontDraw;
+			}
+		}
+		#endregion 属性
+
+		#region 构造函数
+		///// <summary>
+		///// 构造函数
+		///// </summary>
+		//internal TotalTextItem()
+		//	: this(null)
+		//{
+		//}
+
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		internal TotalTextItem(/*LayoutBox box*/)
+			: base(/*box,*/ ItemType.TotalText)
+		{
+            //_width = LayoutCommon.DefaultTextItemSizeWidth;
+            //_height = LayoutCommon.DefaultTextItemSizeHeight;
+            //_notTotalValue = string.Empty;
+            //_notTotalFont = LayoutCommon.DefaultItemFont;
+            //_notTotalFontDraw = LayoutCommon.DefaultItemFont;
+            _notTotalColor = Color.Black;
+            _notTotalAlign = TextAlignment.LeftOrTop;
+		}
+		#endregion 构造函数
+
+		#region 函数
+		///// <summary>
+		///// 显示Item属性设置画面
+		///// </summary>
+		///// <returns>
+		///// DialogResult.OK:选中的Item有效,设置成功<br/>
+		///// DialogResult.Cancel:选中的Item有效,取消设置<br/>
+		///// DialogResult.None:LayoutBox不是编辑模式,或选中的Item不是一个
+		///// </returns>
+		//protected override DialogResult ShowItemPropertyDialogInner()
+		//{
+		//	using (TotalTextItemSetting itemPropertySetting = new TotalTextItemSetting())
+		//	{
+		//		itemPropertySetting.IsNew = false;
+		//		itemPropertySetting.IsDataBinding = IsDataBinding;
+		//		itemPropertySetting.TextLocationX = Left;
+		//		itemPropertySetting.TextLocationY = Top;
+		//		itemPropertySetting.TextWidth = Width;
+		//		itemPropertySetting.TextHeight = Height;
+		//		itemPropertySetting.Culture = Culture;
+		//		itemPropertySetting.LineSpace = LineSpace;
+		//		itemPropertySetting.CharacterSpace = CharacterSpace;
+		//		itemPropertySetting.CharacterCount = CharacterCount;
+		//		itemPropertySetting.TextAlign = TextAlign;
+		//		itemPropertySetting.TextAlignVertical = TextAlignVertical;
+		//		itemPropertySetting.TextPreview = DisplayValue;
+		//		itemPropertySetting.TextColor = TextColor;
+		//		itemPropertySetting.ItemStyle = ItemStyle;
+		//		itemPropertySetting.ItemName = TextItemName;
+		//		itemPropertySetting.TextFormat = Format;
+		//		itemPropertySetting.TextFont = Font;
+		//		itemPropertySetting.Wrap = Wrap;
+		//		itemPropertySetting.DefaultValue = DefaultValue;
+
+		//		itemPropertySetting.NotTotalFont = NotTotalFont;
+		//		itemPropertySetting.NotTotalColor = NotTotalColor;
+		//		itemPropertySetting.NotTotalValue = NotTotalValue;
+		//		itemPropertySetting.NotTotalAlign = NotTotalAlign;
+		//		itemPropertySetting.NotTotalAlignVertical = NotTotalAlignVertical;
+
+		//		DialogResult result = itemPropertySetting.ShowDialog();
+		//		if (result == DialogResult.OK)
+		//		{
+		//			Left = itemPropertySetting.TextLocationX;
+		//			Top = itemPropertySetting.TextLocationY;
+		//			Width = itemPropertySetting.TextWidth;
+		//			Height = itemPropertySetting.TextHeight;
+		//			LineSpace = itemPropertySetting.LineSpace;
+		//			CharacterSpace = itemPropertySetting.CharacterSpace;
+		//			CharacterCount = itemPropertySetting.CharacterCount;
+		//			Font = itemPropertySetting.TextFont;
+		//			Wrap = itemPropertySetting.Wrap;
+		//			TextAlign = itemPropertySetting.TextAlign;
+		//			TextAlignVertical = itemPropertySetting.TextAlignVertical;
+		//			TextColor = itemPropertySetting.TextColor;
+		//			DisplayValue = itemPropertySetting.TextPreview;
+		//			ItemStyle = itemPropertySetting.ItemStyle;
+		//			TextItemName = itemPropertySetting.ItemName;
+		//			Format = itemPropertySetting.TextFormat;
+		//			Culture = itemPropertySetting.Culture;
+		//			DefaultValue = itemPropertySetting.DefaultValue;
+
+		//			NotTotalFont = itemPropertySetting.NotTotalFont;
+		//			NotTotalColor = itemPropertySetting.NotTotalColor;
+		//			NotTotalValue = itemPropertySetting.NotTotalValue;
+		//			NotTotalAlign = itemPropertySetting.NotTotalAlign;
+		//			NotTotalAlignVertical = itemPropertySetting.NotTotalAlignVertical;
+
+		//			ResetItemFrame();
+		//			SetDrawProperty();
+		//			Owner.Dirty = true;
+		//		}
+		//		return result;
+		//	}
+		//}
+
+		/// <summary>
+		/// Item初始化
+		/// </summary>
+		/// <param name="box">LayoutBox</param>
+		/// <param name="isNewID">是否生成新ID</param>
+		/// <returns>是否成功</returns>
+		internal override bool Init(/*LayoutBox box, bool isNewID*/)
+		{
+			//if (_notTotalFontDraw == null)
+			//{
+			//	if (_notTotalFont == null)
+			//	{
+			//		_notTotalFont = LayoutCommon.DefaultItemFont;
+			//		_notTotalFontDraw = LayoutCommon.DefaultItemFont;
+			//	}
+			//	else
+			//	{
+			//		_notTotalFontDraw = new Font(_notTotalFont.FontFamily, _notTotalFont.Size,
+			//			_notTotalFont.Style & (FontStyle.Regular | FontStyle.Bold | FontStyle.Italic));
+			//	}
+			//}
+
+			bool isInit = base.Init(/*box, isNewID*/);
+			return isInit;
+		}
+
+		///// <summary>
+		///// 初始化Item绘制用属性
+		///// </summary>
+		//internal override float SetDrawProperty()
+		//{
+		//	float zoom = base.SetDrawProperty();
+		//	if (0 < zoom)
+		//	{
+		//		_notTotalFontDraw = new Font(_notTotalFont.FontFamily, _notTotalFont.Size * zoom, _notTotalFontDraw.Style);
+		//	}
+		//	return zoom;
+		//}
+
+		///// <summary>
+		///// 初始化Item绘制用属性
+		///// </summary>
+		//internal override float SetRectangleF()
+		//{
+		//   return base.SetRectangleF();
+		//}
+
+		///// <summary>
+		///// Item图形上的OnPaint事件
+		///// </summary>
+		///// <param name="sender">指定的对象</param>
+		///// <param name="e">提供的事件数据</param>
+		//protected override void OnPaint(object sender, PaintEventArgs e)
+		//{
+		//	if (_owner != null && _owner.LayoutMode == LayoutMode.Preview)
+		//	{
+		//		if (_owner.CurrentPageNum != _owner.TotalPageNum && NotTotalValue != "[#合计值#]")
+		//		{
+		//			LayoutUtility.DrawText(e.Graphics,
+		//									GraphicsUnit.Millimeter,
+		//									RectangleFDraw,
+		//									_marginRectangleFDraw,
+		//									NotTotalValue,
+		//									NotTotalFontDraw,
+		//									NotTotalColor,
+		//									LineSpaceDraw,
+		//									CharacterSpaceDraw,
+		//									CharacterCount,
+		//									NotTotalAlign,
+		//									NotTotalAlignVertical,
+		//									Wrap,
+		//									Clip,
+		//									Selected);
+		//			return;
+		//		}
+		//	}
+		//	string Text = ResetTextValue(DataValue, BoundField.IsDataBound) as string;
+		//	LayoutUtility.DrawText(e.Graphics,
+		//							GraphicsUnit.Millimeter,
+		//							RectangleFDraw,
+		//							_marginRectangleFDraw,
+		//							Text,
+		//							FontDraw,
+		//							TextColor,
+		//							LineSpaceDraw,
+		//							CharacterSpaceDraw,
+		//							CharacterCount,
+		//							TextAlign,
+		//							TextAlignVertical,
+		//							Wrap,
+		//							Clip,
+		//							Selected);
+		//}
+		#endregion 函数
+	}
+}

+ 37 - 0
DK.Service/InvoiceLayout/Items/EllipseItem.cs

@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:EllipseItem.cs
+ *		2.功能描述:椭圆Item
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class EllipseItem : GraphicsItem
+	{
+		#region 构造函数
+		///// <summary>
+		///// 构造函数
+		///// </summary>
+		//internal EllipseItem()
+		//	: this(null)
+		//{
+		//}
+
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		/// <param name="box">Layoutbox</param>
+		/// <param name="itemType">item类别</param>
+		internal EllipseItem(/*LayoutBox box*/)
+			: base(/*box, */ItemType.Ellipse)
+		{
+		}
+		#endregion 构造函数
+	}
+}

+ 221 - 0
DK.Service/InvoiceLayout/Items/GraphicsItem.cs

@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:LayoutItem.cs
+ *		2.功能描述:全部LayoutItem的基类(定义为abstract)
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public abstract class GraphicsItem : LayoutItem
+	{
+		#region 成员变量
+		protected Color _fillColor = Color.Black;				// 背景填充色
+		protected bool _isTransparent = true;					// 背景透明
+		protected Color _lineColor = Color.Black;			// 边框色
+		protected float _lineWidth = 0.1f;							// 边框宽 (mm単位)
+		protected float _lineWidthDraw = 0.1f;					// 边框宽 - 绘制用 (mm単位)
+		#endregion 成员变量
+
+		#region 属性
+		/// <summary>
+		/// 获取或设置Item的边框颜色。
+		/// </summary>
+		public Color LineColor
+		{
+			get
+			{
+				return _lineColor;
+			}
+			set
+			{
+				if (!value.Equals(_lineColor))
+				{
+					_lineColor = value;
+					//SetShapeProperty(GetZoom());
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item的边框宽度。
+		/// </summary>
+		/// <remarks>
+		/// 设置小于0时,不显示边框。
+		/// </remarks>
+		public float LineWidth
+		{
+			get
+			{
+				return _lineWidth;
+			}
+			set
+			{
+				if (value < 0)
+				{
+					return;
+				}
+				if (value != _lineWidth)
+				{
+					_lineWidth = value;
+					//float zoom = GetZoom();
+					//_lineWidthDraw = _lineWidth * zoom;
+					//SetShapeProperty(zoom);
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item的背景填充色。
+		/// </summary>
+		public Color FillColor
+		{
+			get
+			{
+				return _fillColor;
+			}
+			set
+			{
+				if (!value.Equals(_fillColor))
+				{
+					_fillColor = value;
+					//SetShapeProperty(GetZoom());
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item的背景是否透明。
+		/// </summary>
+		public bool Transparent
+		{
+			get
+			{
+				return _isTransparent;
+			}
+			set
+			{
+				if (value != _isTransparent)
+				{
+					_isTransparent = value;
+					//SetShapeProperty(GetZoom());
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+		#endregion 属性
+
+		#region 构造函数
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		/// <param name="box">Layoutbox</param>
+		/// <param name="itemType">item类别</param>
+		internal GraphicsItem(/*LayoutBox box, */ItemType itemType)
+			: base(/*box, */itemType)
+		{
+			//_width = LayoutConsts.SHAPE_ITEM_SIZE_DEFAULT_WIDTH;
+			//_height = LayoutConsts.SHAPE_ITEM_SIZE_DEFAULT_HEIGHT;
+		}
+		#endregion 构造函数
+
+		#region 函数
+		///// <summary>
+		///// 显示Item属性设置画面
+		///// </summary>
+		///// <returns>
+		///// DialogResult.OK:选中的Item有效,设置成功<br/>
+		///// DialogResult.Cancel:选中的Item有效,取消设置<br/>
+		///// DialogResult.None:LayoutBox不是编辑模式,或选中的Item不是一个
+		///// </returns>
+		//protected override DialogResult ShowItemPropertyDialogInner()
+		//{
+		//	using (GraphicsItemSetting itemPropertySetting = new GraphicsItemSetting())
+		//	{
+		//		itemPropertySetting.ShapeLocationX = Left;
+		//		itemPropertySetting.ShapeLocationY = Top;
+		//		itemPropertySetting.ShapeWidth = Width;
+		//		itemPropertySetting.ShapeHeight = Height;
+		//		itemPropertySetting.LineColor = LineColor;
+		//		itemPropertySetting.FillColor = FillColor;
+		//		itemPropertySetting.LineWidth = LineWidth;
+		//		itemPropertySetting.Transparent = Transparent;
+		//		DialogResult result = itemPropertySetting.ShowDialog();
+		//		if (result == DialogResult.OK)
+		//		{
+		//			Left = itemPropertySetting.ShapeLocationX;
+		//			Top = itemPropertySetting.ShapeLocationY;
+		//			Width = itemPropertySetting.ShapeWidth;
+		//			Height = itemPropertySetting.ShapeHeight;
+		//			LineColor = itemPropertySetting.LineColor;
+		//			FillColor = itemPropertySetting.FillColor;
+		//			LineWidth = itemPropertySetting.LineWidth;
+		//			Transparent = itemPropertySetting.Transparent;
+		//			ResetItemFrame();
+		//			SetDrawProperty();
+		//			Owner.Dirty = true;
+		//		}
+		//		return result;
+		//	}
+		//}
+
+		///// <summary>
+		///// 初始化Item图形属性
+		///// </summary>
+		//internal override void SetShapeProperty(float zoom)
+		//{
+		//	if (_shape != null)
+		//	{
+		//		if (_lineWidthDraw > 0)
+		//		{
+		//			_shape.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid;
+		//			_shape.BorderColor = _lineColor;
+		//			_shape.BorderWidth = LayoutCommon.MillimeterToPixel(_lineWidthDraw);
+		//		}
+		//		else
+		//		{
+		//			_shape.BorderStyle = System.Drawing.Drawing2D.DashStyle.Custom;
+		//			_shape.BorderWidth = 1;
+		//		}
+		//		if (_simpleShape != null)
+		//		{
+		//			_simpleShape.FillStyle = (_isTransparent) ? FillStyle.Transparent : FillStyle.Solid;
+		//			_simpleShape.FillColor = _fillColor;
+		//		}
+		//	}
+		//}
+
+		///// <summary>
+		///// 初始化Item绘制用属性
+		///// </summary>
+		//internal override float SetDrawProperty()
+		//{
+		//	float zoom = base.SetDrawProperty();
+		//	_lineWidthDraw = _lineWidth * zoom;
+		//	SetShapeProperty(zoom);
+		//	return zoom;
+		//}
+		#endregion 函数
+	}
+}

+ 6 - 0
DK.Service/InvoiceLayout/Items/IBoundItem.cs

@@ -0,0 +1,6 @@
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+    public interface IBoundItem
+    {
+    }
+}

+ 162 - 0
DK.Service/InvoiceLayout/Items/ImageItem.cs

@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:ImageItem.cs
+ *		2.功能描述:图片Item
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class ImageItem : LayoutItem
+	{
+		#region 成员变量
+		private string _fileName = string.Empty;			// 图片文件的路径(全名)
+		private Image _image;									// 图片
+		#endregion 成员变量
+
+		#region 属性
+		/// <summary>
+		/// 获取或设置图片文件的路径(全名)
+		/// </summary>
+		public string FileName
+		{
+			get
+			{
+				return _fileName;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_fileName))
+				{
+					_fileName = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置图片
+		/// </summary>
+		public Image Image
+		{
+			get
+			{
+				return _image;
+			}
+			set
+			{
+				_image = value;
+				//if (SimpleShape != null)
+				//{
+				//	SimpleShape.BackgroundImageLayout = ImageLayout.Stretch;
+				//	SimpleShape.BackgroundImage = _image;
+				//}
+				//if (Owner != null)
+				//{
+				//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+				//}
+			}
+		}
+		#endregion 属性
+
+		#region 构造函数
+		///// <summary>
+		///// 构造函数
+		///// </summary>
+		//internal ImageItem()
+		//	: this(null)
+		//{
+		//}
+
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		/// <param name="box">Layoutbox</param>
+		/// <param name="itemType">item类别</param>
+		internal ImageItem(/*LayoutBox box*/)
+			: base(/*box, */ItemType.Image)
+		{
+			//_width = LayoutConsts.SHAPE_ITEM_SIZE_DEFAULT_WIDTH;
+			//_height = LayoutConsts.SHAPE_ITEM_SIZE_DEFAULT_HEIGHT;
+			//if (box != null)
+			//{
+			//	if (_simpleShape != null)
+			//	{
+			//		_simpleShape.BackgroundImageLayout = ImageLayout.Stretch;
+			//		_simpleShape.BackgroundImage = _image;
+			//	}
+			//}
+		}
+        #endregion 构造函数
+
+        #region 函数
+        ///// <summary>
+        ///// 显示Item属性设置画面
+        ///// </summary>
+        ///// <returns>
+        ///// DialogResult.OK:选中的Item有效,设置成功<br/>
+        ///// DialogResult.Cancel:选中的Item有效,取消设置<br/>
+        ///// DialogResult.None:LayoutBox不是编辑模式,或选中的Item不是一个
+        ///// </returns>
+        //protected override DialogResult ShowItemPropertyDialogInner()
+        //{
+        //	using (ImageItemSetting itemPropertySetting = new ImageItemSetting())
+        //	{
+        //		itemPropertySetting.ImageLocationX = Left;
+        //		itemPropertySetting.ImageLocationY = Top;
+        //		itemPropertySetting.ImageWidth = Width;
+        //		itemPropertySetting.ImageHeight = Height;
+        //		itemPropertySetting.SideRatioFixed = SideRatioFixed;
+        //		itemPropertySetting.FileName = FileName;
+        //		itemPropertySetting.Image = Image;
+        //		DialogResult result = itemPropertySetting.ShowDialog();
+        //		if (result == DialogResult.OK)
+        //		{
+        //			Left = itemPropertySetting.ImageLocationX;
+        //			Top = itemPropertySetting.ImageLocationY;
+        //			Width = itemPropertySetting.ImageWidth;
+        //			Height = itemPropertySetting.ImageHeight;
+        //			SideRatioFixed = itemPropertySetting.SideRatioFixed;
+        //			ResetItemFrame();
+        //			SetDrawProperty();
+        //			Owner.Dirty = true;
+        //		}
+        //		return result;
+        //	}
+        //}
+
+        ///// <summary>
+        ///// Item初始化
+        ///// </summary>
+        ///// <param name="box">LayoutBox</param>
+        ///// <param name="isNewID">是否生成新ID</param>
+        ///// <returns>是否成功</returns>
+        //internal override bool Init(LayoutBox box, bool isNewID)
+        //{
+        //	bool isInit = base.Init(box, isNewID);
+        //	if (isInit)
+        //	{
+        //		if (_simpleShape != null)
+        //		{
+        //			_simpleShape.BackgroundImageLayout = ImageLayout.Stretch;
+        //			_simpleShape.BackgroundImage = _image;
+        //		}
+        //	}
+        //	return isInit;
+        //}
+        #endregion 函数
+    }
+}

+ 1069 - 0
DK.Service/InvoiceLayout/Items/LayoutItem.cs

@@ -0,0 +1,1069 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:LayoutItem.cs
+ *		2.功能描述:全部LayoutItem的基类(定义为abstract)
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Drawing;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public abstract class LayoutItem //: ICloneable, IDisposable
+	{
+		#region 成员变量
+		private int _id;												// ID
+		private object _tag;											// 扩展
+		private readonly ItemType _type;						// Item类别
+		// 位置
+		protected float _top;										// 上位置X (mm単位)
+		protected float _left;										// 左位置Y (mm単位)
+		protected float _width;									// 宽 (mm単位)
+		protected float _height;									// 高 (mm単位)
+		protected float _right;										// 右位置 (mm単位)
+		protected float _bottom;									// 下位置 (mm単位)
+		protected bool _sideRatioFixed = false;         // 横纵比例是否固定
+        private ItemLock _lock = ItemLock.None;         // Item锁定
+        #endregion 成员变量
+
+        #region 属性
+        /// <summary>
+        /// LayoutBox内使用的Item标识。
+        /// </summary>
+        /// <remarks>
+        /// </remarks>
+        public int ID
+		{
+			get
+			{
+				return _id;
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item类别。
+		/// </summary>
+		public ItemType ItemType
+		{
+			get
+			{
+				return _type;
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item在LayoutBox内的X坐标 mm单位。
+		/// </summary>
+		public float Top
+		{
+			get
+			{
+				return _top;
+			}
+			set
+			{
+				if (value != _top)
+				{
+                    SetTop(value);
+                }
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item在LayoutBox内的Y坐标 mm单位。
+		/// </summary>
+		public float Left
+		{
+			get
+			{
+				return _left;
+			}
+			set
+			{
+				if (value != _left)
+				{
+                    SetLeft(value);
+                }
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item在LayoutBox内的宽 mm单位。
+		/// </summary>
+		public float Width
+		{
+			get
+			{
+				return _width;
+			}
+			set
+			{
+				if (value != _width)
+				{
+                    SetWidth(value);
+                }
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item在LayoutBox内的高 mm单位。
+		/// </summary>
+		public float Height
+		{
+			get
+			{
+				return _height;
+			}
+			set
+			{
+				if (value != _height)
+				{
+                    SetHeight(value);
+                }
+			}
+		}
+
+		/// <summary>
+		/// 获取Item在LayoutBox内的右位置 mm单位。
+		/// </summary>
+		public float Right
+		{
+			get
+			{
+				return _left + _width;
+				//return _right;
+			}
+			//set
+			//{
+			//    if (value != _right)
+			//    {
+			//        if (SetRight(value) && _owner != null)
+			//        {
+			//            _owner.SetItemChangedArgs(this, ItemChangeType.Change);
+			//        }
+			//    }
+			//}
+		}
+
+		/// <summary>
+		/// 获取Item在LayoutBox内的下位置 mm单位。
+		/// </summary>
+		public float Bottom
+		{
+			get
+			{
+				return _top + _height;
+				//return _bottom;
+			}
+			//set
+			//{
+			//    if (value != _bottom)
+			//    {
+			//        if (SetBottom(value) && _owner != null)
+			//        {
+			//            _owner.SetItemChangedArgs(this, ItemChangeType.Change);
+			//        }
+			//    }
+			//}
+		}
+
+		/// <summary>
+		/// 获取或设置图片横纵比例是否固定
+		/// </summary>
+		public bool SideRatioFixed
+		{
+			get
+			{
+				return _sideRatioFixed;
+			}
+			set
+			{
+				if (value != _sideRatioFixed)
+				{
+					_sideRatioFixed = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 获取或设置Item锁定
+		/// </summary>
+		internal ItemLock ItemLockType
+		{
+			get
+			{
+				return _lock;
+			}
+			set
+			{
+				if (value != _lock)
+				{
+					_lock = value;
+					//ResetItemFrame();
+				}
+			}
+		}
+
+		///// <summary>
+		///// 获取Item是否是选择状态。
+		///// </summary>
+		//public bool Selected
+		//{
+		//	get
+		//	{
+		//		return false;
+		//	}
+		//	//internal set
+		//	//{
+		//	//	if (value != _isSelected)
+		//	//	{
+		//	//		_isSelected = value;
+		//	//	}
+		//	//}
+		//}
+
+		///// <summary>
+		///// 获取或设置是否是新追加的Item。
+		///// </summary>
+		//internal bool IsNew
+		//{
+		//	get
+		//	{
+		//		return false;
+		//	}
+		//	//set
+		//	//{
+		//	//	_isNew = value;
+		//	//}
+		//}
+
+		///// <summary>
+		///// Item对应的图形
+		///// </summary>
+		//internal Shape Shape
+		//{
+		//	get
+		//	{
+		//		return _shape;
+		//	}
+		//	private set
+		//	{
+		//		if (_shape != value)
+		//		{
+		//			if (_shape != null)
+		//			{
+		//				_shape.Dispose();
+		//			}
+		//			_shape = value;
+		//			if (_shape != null)
+		//			{
+		//				if (_shape is SimpleShape)
+		//				{
+		//					_simpleShape = _shape as SimpleShape;
+		//				}
+		//				else if (_shape is LineShape)
+		//				{
+		//					_lineShape = _shape as LineShape;
+		//				}
+		//				SetShapeProperty(GetZoom());
+		//				if (_owner != null && !_owner.ItemShapes.Contains(_shape))
+		//				{
+		//					_owner.ItemShapes.Add(_shape);
+		//					_shape.BringToFront();
+		//				}
+		//				_shape.DoubleClick += new EventHandler(OnDoubleClickControl);
+		//				_shape.MouseDown += new MouseEventHandler(OnMouseDownControl);
+		//				_shape.PreviewKeyDown += new PreviewKeyDownEventHandler(OnPreviewKeyDown);
+		//				_shape.MouseMove += new MouseEventHandler(OnMouseMove);
+		//				_shape.Paint += new PaintEventHandler(OnPaint);
+		//				ResetShapeLocationAndSize(false);
+		//			}
+		//		}
+		//	}
+		//}
+		//protected SimpleShape SimpleShape
+		//{
+		//	get
+		//	{
+		//		return _simpleShape;
+		//	}
+		//}
+		//protected LineShape LineShape
+		//{
+		//	get
+		//	{
+		//		return _lineShape;
+		//	}
+		//}
+
+		///// <summary>
+		///// 图形范围
+		///// </summary>
+		//internal protected virtual Rectangle ShapeBounds
+		//{
+		//	get
+		//	{
+		//		return _simpleShape != null ? _simpleShape.Bounds : Rectangle.Empty;
+		//	}
+		//}
+
+		///// <summary>
+		///// 
+		///// </summary>
+		//internal protected virtual Rectangle ShapeVirtualBounds
+		//{
+		//	get
+		//	{
+		//		return ShapeBounds;
+		//	}
+		//}
+
+		///// <summary>
+		///// 获取或设置Item的选中边框
+		///// </summary>
+		//internal ItemFrame Frame
+		//{
+		//	get
+		//	{
+		//		return _frame;
+		//	}
+		//	set
+		//	{
+		//		if (_frame != value)
+		//		{
+		//			_frame = value;
+		//		}
+		//	}
+		//}
+
+		///// <summary>
+		///// 获取或设置Item的范围 - 绘制用 (mm単位)
+		///// </summary>
+		//protected virtual RectangleF RectangleFDraw
+		//{
+		//	get
+		//	{
+		//		return _rectangleFDraw;
+		//	}
+		//	set
+		//	{
+		//		_rectangleFDraw = value;
+		//	}
+		//}
+		#endregion 属性
+
+		#region 构造函数
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		/// <param name="box">Layoutbox</param>
+		/// <param name="itemType">item类别</param>
+		internal LayoutItem(/*LayoutBox box, */ItemType itemType)
+		{
+			//_rectangleFDraw = RectangleF.Empty;
+			//_top = LayoutConsts.ITEM_LOCATION_DEF;
+			//_left = LayoutConsts.ITEM_LOCATION_DEF;
+			_width = 0f;
+			_height = 0f;
+			_right = _left + _width;
+			_bottom = _top + _height;
+			_id = 0;
+			_type = itemType;
+			//Owner = box;
+
+			//if (_owner != null)
+			//{
+			//	_id = _owner.NewItemID;
+			//	Shape = LayoutUtility.GetNewShape(this);
+			//	//SetShapeProperty();
+			//	SetDrawProperty();
+			//}
+		}
+		#endregion 构造函数
+
+		#region 事件处理
+		///// <summary>
+		///// Item图形上的OnPaint事件
+		///// </summary>
+		///// <param name="sender">指定的对象</param>
+		///// <param name="e">提供的事件数据</param>
+		//protected virtual void OnPaint(object sender, PaintEventArgs e)
+		//{
+		//}
+		#endregion 事件处理
+
+		#region 函数
+		/// <summary>
+		/// Item初始化
+		/// </summary>
+		/// <param name="box">LayoutBox</param>
+		/// <param name="isNewID">是否生成新ID</param>
+		/// <returns>是否成功</returns>
+		internal virtual bool Init(/*LayoutBox box, bool isNewID*/)
+		{
+			//Owner = box;
+			//if (_owner == null)
+			//{
+			//	return false;
+			//}
+			//if (isNewID)
+			//{
+			//	_id = _owner.NewItemID;
+			//}
+			//Shape = LayoutUtility.GetNewShape(this);
+			////SetShapeProperty();
+			//SetDrawProperty();
+			return true;
+		}
+
+		///// <summary>
+		///// 刷新显示
+		///// </summary>
+		//public virtual void Refresh()
+		//{
+		//	if (_shape != null)
+		//	{
+		//		_shape.Refresh();
+		//	}
+		//}
+
+		///// <summary>
+		///// 显示Item属性设置画面
+		///// </summary>
+		///// <returns>
+		///// DialogResult.OK:选中的Item有效,设置成功<br/>
+		///// DialogResult.Cancel:选中的Item有效,取消设置<br/>
+		///// DialogResult.None:LayoutBox不是编辑模式,或选中的Item不是一个
+		///// </returns>
+		//public DialogResult ShowItemPropertyDialog()
+		//{
+		//	if (_owner != null && _owner.LayoutMode == LayoutMode.Edit)
+		//	{
+		//		// 显示Item属性设置画面
+		//		DialogResult dialogResult = ShowItemPropertyDialogInner();
+		//		if (dialogResult == DialogResult.OK)
+		//		{
+		//			//_owner.PaperArea.Refresh();
+		//		}
+		//		return dialogResult;
+		//	}
+		//	return DialogResult.None;
+		//}
+
+		///// <summary>
+		///// 显示Item属性设置画面 - 子类实例化用
+		///// </summary>
+		///// <returns>
+		///// DialogResult.OK:选中的Item有效,设置成功<br/>
+		///// DialogResult.Cancel:选中的Item有效,取消设置<br/>
+		///// DialogResult.None:LayoutBox不是编辑模式,或选中的Item不是一个
+		///// </returns>
+		//protected virtual DialogResult ShowItemPropertyDialogInner()
+		//{
+		//	throw new NotImplementedException();
+		//}
+
+		///// <summary>
+		///// 改变Item的选择状态
+		///// </summary>
+		///// <param name="value">选中:true,取消选择:false</param>
+		//public void Select(bool value)
+		//{
+		//	if (_owner.LayoutMode != LayoutMode.Edit)
+		//	{
+		//		return;
+		//	}
+		//	if (_owner != null)
+		//	{
+		//		_owner.SelectItemMultiple(this, value);
+		//	}
+		//}
+
+		///// <summary>
+		///// 刷新显示Item选择边框
+		///// </summary>
+		//internal void ResetItemFrame()
+		//{
+		//	if (_isSelected && _frame != null)
+		//	{
+		//		_frame.CreateFrame();
+		//	}
+		//}
+
+		///// <summary>
+		///// 改变Item图形的位置和大小
+		///// </summary>
+		//protected virtual bool ResetShapeLocationAndSize(int left, int top, int width, int height)
+		//{
+		//	if (_simpleShape != null)
+		//	{
+		//		_simpleShape.Location = new Point(left, top);
+		//		_simpleShape.Size = new Size(width, height);
+		//		return true;
+		//	}
+		//	return false;
+		//}
+		//protected virtual bool ResetShapeLocation(int left, int top)
+		//{
+		//	if (_simpleShape != null)
+		//	{
+		//		_simpleShape.Location = new Point(left, top);
+		//		return true;
+		//	}
+		//	return false;
+		//}
+		//protected virtual bool ResetShapeSize(int width, int height)
+		//{
+		//	if (_simpleShape != null)
+		//	{
+		//		_simpleShape.Size = new Size(width, height);
+		//		return true;
+		//	}
+		//	return false;
+		//}
+		///// <summary>
+		///// 根据zoom改变Item与Item图形的位置和大小
+		///// </summary>
+		//protected virtual bool ResetItemLocationAndSize(int left, int top, int width, int height)
+		//{
+		//	bool l = ResetItemLocation(left, top);
+		//	bool s = ResetItemSize(width, height);
+		//	return l && s;
+		//}
+		//protected virtual bool ResetItemLocation(int left, int top)
+		//{
+		//	if (_lock == ItemLock.LockLocationAndSize)
+		//	{
+		//		return false;
+		//	}
+		//	int zoom = 100;
+		//	if (_owner != null)
+		//	{
+		//		zoom = _owner.Zoom;
+		//	}
+		//	if (_simpleShape != null && 0 < zoom)
+		//	{
+		//		if (_simpleShape.Top != top || _simpleShape.Left != left)
+		//		{
+		//			if (_simpleShape.Top != top)
+		//			{
+		//				_top = LayoutCommon.PixelToMillimeter(top, zoom);
+		//				_bottom = _top + _height;
+		//			}
+		//			if (_simpleShape.Left != left)
+		//			{
+		//				_left = LayoutCommon.PixelToMillimeter(left, zoom);
+		//				_right = _left + _width;
+		//			}
+		//			_simpleShape.Location = new Point(left, top);
+		//			SetRectangleF();
+		//			if (_owner != null)
+		//			{
+		//				_owner.SetItemChangedArgs(this, ItemChangeType.Moved);
+		//			}
+		//		}
+		//	}
+		//	return true;
+		//}
+		//protected virtual bool ResetItemSize(int width, int height)
+		//{
+		//	if (_lock != ItemLock.None)
+		//	{
+		//		return false;
+		//	}
+		//	int zoom = 100;
+		//	if (_owner != null)
+		//	{
+		//		zoom = _owner.Zoom;
+		//	}
+		//	if (_simpleShape != null && 0 < zoom)
+		//	{
+		//		if (_simpleShape.Width != width || _simpleShape.Height != height)
+		//		{
+		//			if (_simpleShape.Width != width)
+		//			{
+		//				_width = LayoutCommon.PixelToMillimeter(width, zoom);
+		//				_right = _left + _width;
+		//			}
+		//			if (_simpleShape.Height != height)
+		//			{
+		//				_height = LayoutCommon.PixelToMillimeter(height, zoom);
+		//				_bottom = _top + _height;
+		//			}
+		//			_simpleShape.Size = new Size(width, height);
+		//			SetRectangleF();
+		//			if (_owner != null)
+		//			{
+		//				_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+		//			}
+		//		}
+		//	}
+		//	return true;
+		//}
+		///// <summary>
+		///// 根据zoom与Item图形的位置和大小,改变Item的位置和大小
+		///// </summary>
+		//protected virtual bool ResetItemLocationAndSize()
+		//{
+		//	bool l = ResetItemLocation();
+		//	bool s = ResetItemSize();
+		//	return l && s;
+		//}
+		//protected virtual bool ResetItemLocation()
+		//{
+		//	if (_lock == ItemLock.LockLocationAndSize)
+		//	{
+		//		return false;
+		//	}
+		//	int zoom = 100;
+		//	if (_owner != null)
+		//	{
+		//		zoom = _owner.Zoom;
+		//	}
+		//	if (_simpleShape != null && 0 < zoom)
+		//	{
+		//		float top = LayoutCommon.PixelToMillimeter(_simpleShape.Top, zoom);
+		//		float left = LayoutCommon.PixelToMillimeter(_simpleShape.Left, zoom);
+		//		if (_top != top || _left != left)
+		//		{
+		//			if (_top != top)
+		//			{
+		//				_top = top;
+		//				_bottom = _top + _height;
+		//			}
+		//			if (_left != left)
+		//			{
+		//				_left = left;
+		//				_right = _left + _width;
+		//			}
+		//			SetRectangleF();
+		//			if (_owner != null)
+		//			{
+		//				_owner.SetItemChangedArgs(this, ItemChangeType.Moved);
+		//			}
+		//		}
+		//	}
+		//	return true;
+		//}
+		//protected virtual bool ResetItemSize()
+		//{
+		//	if (_lock != ItemLock.None)
+		//	{
+		//		return false;
+		//	}
+		//	int zoom = 100;
+		//	if (_owner != null)
+		//	{
+		//		zoom = _owner.Zoom;
+		//	}
+		//	if (_simpleShape != null && 0 < zoom)
+		//	{
+		//		float width = LayoutCommon.PixelToMillimeter(_simpleShape.Width, zoom);
+		//		float height = LayoutCommon.PixelToMillimeter(_simpleShape.Height, zoom);
+		//		if (_width != width || _height != height)
+		//		{
+		//			if (_width != width)
+		//			{
+		//				_width = width;
+		//				_right = _left + _width;
+		//			}
+		//			if (_height != height)
+		//			{
+		//				_height = height;
+		//				_bottom = _top + _height;
+		//			}
+		//			SetRectangleF();
+		//			if (_owner != null)
+		//			{
+		//				_owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+		//			}
+		//		}
+		//	}
+		//	return true;
+		//}
+
+		/// <summary>
+		/// 设置Item的X坐标
+		/// </summary>
+		/// <param name="value">X坐标</param>
+		protected virtual bool SetTop(float value)
+		{
+			//if (_lock == ItemLock.LockLocationAndSize)
+			//{
+			//	return false;
+			//}
+			//if (value < LayoutConsts.ITEM_LOCATION_MIN
+			//	|| LayoutConsts.ITEM_LOCATION_MAX < value
+			//	|| _owner.PaperHeight <= value)
+			//{
+			//	return false;
+			//}
+			//_top = value;
+			//_bottom = _top + _height;
+			//SetRectangleF();
+			//if (_simpleShape != null && _owner != null)
+			//{
+			//	_simpleShape.Top = LayoutCommon.MillimeterToPixel(_top, _owner.Zoom);
+			//	ResetItemFrame();
+			//}
+			return true;
+		}
+		/// <summary>
+		/// 设置Item的Y坐标
+		/// </summary>
+		/// <param name="value">Y坐标</param>
+		protected virtual bool SetLeft(float value)
+		{
+			//if (_lock == ItemLock.LockLocationAndSize)
+			//{
+			//	return false;
+			//}
+			//if (value < LayoutConsts.ITEM_LOCATION_MIN
+			//	|| LayoutConsts.ITEM_LOCATION_MAX < value
+			//	|| _owner.PaperWidth <= value)
+			//{
+			//	return false;
+			//}
+			//_left = value;
+			//_right = _left + _width;
+			//SetRectangleF();
+			//if (_simpleShape != null && _owner != null)
+			//{
+			//	_simpleShape.Left = LayoutCommon.MillimeterToPixel(_left, _owner.Zoom);
+			//	ResetItemFrame();
+			//}
+			return true;
+		}
+		/// <summary>
+		/// 设置Item的宽度
+		/// </summary>
+		/// <param name="value">宽</param>
+		protected virtual bool SetWidth(float value)
+		{
+			//if (_lock != ItemLock.None)
+			//{
+			//	return false;
+			//}
+			//if (value < LayoutConsts.ITEM_SIZE_MIN
+			//	|| LayoutConsts.ITEM_SIZE_WIDTH_MAX < value)
+			//{
+			//	return false;
+			//}
+			//float hValue = _height;
+			//if (_sideRatioFixed)
+			//{
+			//	hValue = _height / _width * value;
+			//	if (hValue < LayoutConsts.ITEM_SIZE_MIN
+			//		|| LayoutConsts.ITEM_SIZE_WIDTH_MAX < hValue)
+			//	{
+			//		return false;
+			//	}
+			//	_height = hValue;
+			//	_bottom = _top + _height;
+			//}
+			//_width = value;
+			//_right = _left + _width;
+			//SetRectangleF();
+			//if (_simpleShape != null && _owner != null)
+			//{
+			//	if (_sideRatioFixed)
+			//	{
+			//		_simpleShape.Size = new Size(
+			//			LayoutCommon.MillimeterToPixel(_width, _owner.Zoom),
+			//			LayoutCommon.MillimeterToPixel(_height, _owner.Zoom));
+			//	}
+			//	else
+			//	{
+			//		_simpleShape.Width = LayoutCommon.MillimeterToPixel(_width, _owner.Zoom);
+			//	}
+			//	ResetItemFrame();
+			//}
+			return true;
+		}
+		/// <summary>
+		/// 设置Item的高度
+		/// </summary>
+		/// <param name="value">高</param>
+		protected virtual bool SetHeight(float value)
+		{
+			//if (_lock != ItemLock.None)
+			//{
+			//	return false;
+			//}
+			//if (value < LayoutConsts.ITEM_SIZE_MIN
+			//	|| LayoutConsts.ITEM_SIZE_HEIGHT_MAX < value)
+			//{
+			//	return false;
+			//}
+			//float wValue = _height;
+			//if (_sideRatioFixed)
+			//{
+			//	wValue = _width / _height * value;
+			//	if (wValue < LayoutConsts.ITEM_SIZE_MIN
+			//		|| LayoutConsts.ITEM_SIZE_WIDTH_MAX < wValue)
+			//	{
+			//		return false;
+			//	}
+			//	_width = wValue;
+			//	_right = _left + _width;
+			//}
+			//_height = value;
+			//_bottom = _top + _height;
+			//SetRectangleF();
+			//if (_simpleShape != null && _owner != null)
+			//{
+			//	if (_sideRatioFixed)
+			//	{
+			//		_simpleShape.Size = new Size(
+			//			LayoutCommon.MillimeterToPixel(_width, _owner.Zoom),
+			//			LayoutCommon.MillimeterToPixel(_height, _owner.Zoom));
+			//	}
+			//	else
+			//	{
+			//		_simpleShape.Height = LayoutCommon.MillimeterToPixel(_height, _owner.Zoom);
+			//	}
+			//	ResetItemFrame();
+			//}
+			return true;
+		}
+
+		///// <summary>
+		///// 移动Item
+		///// </summary>
+		//public virtual bool LeftItem(int value)
+		//{
+		//	//if (_lock == ItemLock.LockLocationAndSize)
+		//	//{
+		//	//	return false;
+		//	//}
+		//	//if (_simpleShape != null && value <= _simpleShape.Left)
+		//	//{
+		//	//	int left = _simpleShape.Left - value;
+		//	//	if (_frame != null)
+		//	//	{
+		//	//		_frame.Left -= value;
+		//	//	}
+		//	//	ResetItemLocation(left, _simpleShape.Top);
+		//	//	return true;
+		//	//}
+		//	return false;
+		//}
+		//public virtual bool UpItem(int value)
+		//{
+		//	if (_lock == ItemLock.LockLocationAndSize)
+		//	{
+		//		return false;
+		//	}
+		//	if (_simpleShape != null && value <= _simpleShape.Top)
+		//	{
+		//		int top = _simpleShape.Top - value;
+		//		if (_frame != null)
+		//		{
+		//			_frame.Top -= value;
+		//		}
+		//		ResetItemLocation(_simpleShape.Left, top);
+		//		return true;
+		//	}
+		//	return false;
+		//}
+		//public virtual bool RightItem(int value)
+		//{
+		//	if (_lock == ItemLock.LockLocationAndSize)
+		//	{
+		//		return false;
+		//	}
+		//	if (_simpleShape != null)
+		//	{
+		//		int left = _simpleShape.Left + value;
+		//		if (_owner != null
+		//			&& left < _owner.PaperArea.Width
+		//			&& left <= _owner.MaxItemLeft)
+		//		{
+		//			if (_frame != null)
+		//			{
+		//				_frame.Left += value;
+		//			}
+		//			ResetItemLocation(left, _simpleShape.Top);
+		//			return true;
+		//		}
+		//	}
+		//	return false;
+		//}
+		//public virtual bool DownItem(int value)
+		//{
+		//	if (_lock == ItemLock.LockLocationAndSize)
+		//	{
+		//		return false;
+		//	}
+		//	if (_simpleShape != null)
+		//	{
+		//		int top = _simpleShape.Top + value;
+		//		if (_owner != null
+		//			&& top < _owner.PaperArea.Height
+		//			&& top <= _owner.MaxItemTop)
+		//		{
+		//			if (_frame != null)
+		//			{
+		//				_frame.Top += value;
+		//			}
+		//			ResetItemLocation(_simpleShape.Left, top);
+		//			return true;
+		//		}
+		//	}
+		//	return false;
+		//}
+		//public virtual bool MoveItem(int left, int top)
+		//{
+		//	if (_lock == ItemLock.LockLocationAndSize)
+		//	{
+		//		return false;
+		//	}
+		//	return ResetItemLocation(left, top);
+		//}
+		//public virtual bool ChangeItemSize(int width, int height)
+		//{
+		//	if (_lock != ItemLock.None)
+		//	{
+		//		return false;
+		//	}
+		//	return ResetItemSize(width, height);
+		//}
+		///// <summary>
+		///// 根据zom与Item,改变Item图形的位置和大小
+		///// </summary>
+		//internal virtual bool ResetShapeLocationAndSize(bool isCheck)
+		//{
+		//	int zoom = 100;
+		//	if (_owner != null)
+		//	{
+		//		zoom = _owner.Zoom;
+		//	}
+		//	if (_shape != null)
+		//	{
+		//		int top = LayoutCommon.MillimeterToPixel(_top, zoom);
+		//		int left = LayoutCommon.MillimeterToPixel(_left, zoom);
+		//		int width = LayoutCommon.MillimeterToPixel(_width, zoom);
+		//		int height = LayoutCommon.MillimeterToPixel(_height, zoom);
+
+		//		ResetShapeLocationAndSize(left, top, width, height);
+		//		ResetItemFrame();
+		//		return true;
+		//	}
+		//	return false;
+		//}
+
+		///// <summary>
+		///// 初始化Item图形属性
+		///// </summary>
+		//internal virtual void SetShapeProperty(float zoom)
+		//{
+		//}
+
+		//internal virtual float GetZoom()
+		//{
+		//	float zoom = 1;
+		//	if (Owner != null)
+		//	{
+		//		zoom = Owner.Zoom / 100f;
+		//	}
+		//	return (0 < zoom) ? zoom : 1;
+		//}
+
+		///// <summary>
+		///// 初始化Item绘制用属性
+		///// </summary>
+		//internal virtual float SetDrawProperty()
+		//{
+		//	float zoom = GetZoom();
+
+		//	_rectangleFDraw.X = Left * zoom;
+		//	_rectangleFDraw.Y = Top * zoom;
+		//	_rectangleFDraw.Width = Width * zoom;
+		//	_rectangleFDraw.Height = (Height - LayoutConsts.TEXT_MARGIN) * zoom;
+		//	return zoom;
+		//}
+
+		///// <summary>
+		///// 初始化Item绘制用范围属性
+		///// </summary>
+		//internal virtual float SetRectangleF()
+		//{
+		//	float zoom = GetZoom();
+
+		//	_rectangleFDraw.X = Left * zoom;
+		//	_rectangleFDraw.Y = Top * zoom;
+		//	_rectangleFDraw.Width = Width * zoom;
+		//	_rectangleFDraw.Height = (Height - LayoutConsts.TEXT_MARGIN) * zoom;
+		//	return zoom;
+		//}
+
+		///// <summary>
+		///// Item图形是否被此范围包含
+		///// </summary>
+		///// <param name="rect"></param>
+		///// <returns></returns>
+		//internal protected virtual bool BoundsContainsBy(Rectangle rect)
+		//{
+		//	return _simpleShape != null ? rect.Contains(_simpleShape.Bounds) : false;
+		//}
+		//internal protected virtual bool BoundsContains(Rectangle rect)
+		//{
+		//	return _simpleShape != null ? _simpleShape.Bounds.Contains(rect) : false;
+		//}
+		//internal protected virtual bool BoundsContains(Point pt)
+		//{
+		//	return _simpleShape != null ? _simpleShape.Bounds.Contains(pt) : false;
+		//}
+
+		//#region ICloneable
+		///// <summary>
+		///// Creates a new object that is a copy of the current instance.
+		///// </summary>
+		///// <returns>A new object that is a copy of this instance.</returns>
+		//public virtual object Clone()
+		//{
+		//	return MemberwiseClone();
+		//}
+		//#endregion ICloneable
+
+		//#region IDisposable
+		///// <summary>
+		///// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+		///// </summary>
+		//public void Dispose()
+		//{
+		//	Dispose(true);
+		//	GC.SuppressFinalize(this);
+		//}
+
+		///// <summary>
+		///// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+		///// </summary>
+		///// <param name="disposing"></param>
+		//protected virtual void Dispose(bool disposing)
+		//{
+		//	if (disposing)
+		//	{
+		//		lock (this)
+		//		{
+		//			if (_shape != null)
+		//			{
+		//				_shape.Dispose();
+		//				_shape = null;
+		//			}
+		//			_owner = null;
+		//		}
+		//	}
+		//}
+		//#endregion IDisposable
+		#endregion 函数
+	}
+}

+ 37 - 0
DK.Service/InvoiceLayout/Items/RectangleItem.cs

@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:RectangleItem.cs
+ *		2.功能描述: 矩形Item
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class RectangleItem : GraphicsItem
+	{
+		#region 构造函数
+		///// <summary>
+		///// 构造函数
+		///// </summary>
+		//internal RectangleItem()
+		//	: this(null)
+		//{
+		//}
+
+		/// <summary>
+		/// 构造函数
+		/// </summary>
+		/// <param name="box">Layoutbox</param>
+		/// <param name="itemType">item类别</param>
+		internal RectangleItem(/*LayoutBox box*/)
+			: base(/*box, */ItemType.Rectangle)
+		{
+		}
+		#endregion 构造函数
+	}
+}

+ 1468 - 0
DK.Service/InvoiceLayout/Items/TextItem.cs

@@ -0,0 +1,1468 @@
+/*******************************************************************************
+ * Copyright(c) 2012 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:TextItem.cs
+ *		2.功能描述: 文本Item
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		欧阳涛				2012/09/14				1.00				新建
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Globalization;
+using System.IO;
+
+using Curtain.Framework.Barcode;
+using Curtain.Framework.Barcode.OneD;
+using Curtain.Framework.Barcode.QRCode;
+using ZXing;
+using ZXing.Common;
+using ZXing.QrCode;
+using ZXing.QrCode.Internal;
+
+namespace Dongke.WinForm.Controls.InvoiceLayout
+{
+	[Serializable]
+	public class TextItem : LayoutItem, IBoundItem
+	{
+		#region 成员变量
+		private string _dataMember;								// 对应数据源中的字段名
+		private string _displayValue;								// 编辑模式显示的值
+		private object _formatType;									// 格式类别
+		private string _format;										// 文本格式
+		private Font _font;												// 文本字体
+		private bool _isUnderline;									// 下划线
+		private bool _isStrikeout;									// 删除线
+		private bool _wrap;											// 是否自动换行
+		private bool _clip;												// 是否剪裁延伸到边框外侧的文本
+		private Color _textColor;										// 文本颜色
+		private TextAlignment _textAlign;							// 文本对齐方式
+		private TextAlignment _textAlignVertical;					// 文本垂直对齐
+		private float _characterSpace;								// 文字间隔
+		private float _lineSpace;										// 文字行间隔
+		private int _characterCount;									// 行文字数
+		private string _defaultValue;								// 文本默认值
+		private string _culture;										// culture
+		private string _defaultItemName;							// 默认项目名
+		private string _textItemName;								// 文本项目名
+		private bool _isDataBinding;								// 是否数据绑定
+		//[NonSerialized]
+		//private string _text;												// 文本
+		//[NonSerialized]
+		//private object _dataValue;									// 数据源中的值
+		//[NonSerialized]
+		//private object _printDataValue;							// 打印数据源中的值
+		//[NonSerialized]
+		//private DataBoundField _boundField;					// 数据源字段
+		//[NonSerialized]
+		//private DataBoundField _printBoundField;			// 打印数据源字段
+		//[NonSerialized]
+		//private Font _fontDraw;										// 绘制字体
+		//[NonSerialized]
+		//private float _lineSpaceDraw;								// 绘制行间隔
+		//[NonSerialized]
+		//private float _characterSpaceDraw;						// 绘制文字间隔
+		//[NonSerialized]
+		//protected RectangleF _marginRectangleFDraw;					// 绘制范围
+		private int _travelDocItemID;								// 项目ID
+		private string _itemCode;                                // 项目ID
+		private int _itemRefClass;									// 分类
+		private ItemStyle _itemStyle;								// 项目类别
+		private string _itemSample;									// 项目示例
+		#endregion 成员变量
+
+		#region 属性
+		/// <summary>
+		/// 对应数据源中的字段名
+		/// </summary>
+		public string DataMember
+		{
+			get
+			{
+				return _dataMember;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_dataMember))
+				{
+					_dataMember = value;
+					//if (Owner != null)
+					//{
+					//	if (Owner.LayoutMode == LayoutMode.Preview)
+					//	{
+					//		Owner.RefreshTextItemBound(this);
+					//	}
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 编辑模式显示的值
+		/// </summary>
+		public string DisplayValue
+		{
+			get
+			{
+				return _displayValue;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_displayValue))
+				{
+					_displayValue = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 格式类别
+		/// </summary>
+		public object FormatType
+		{
+			get
+			{
+				return _formatType;
+			}
+			set
+			{
+				_formatType = value;
+				//if (Owner != null)
+				//{
+				//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+				//}
+			}
+		}
+
+		/// <summary>
+		/// 文本格式
+		/// </summary>
+		public string Format
+		{
+			get
+			{
+				return _format;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_format))
+				{
+					_format = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本字体
+		/// </summary>
+		public Font Font
+		{
+			get
+			{
+				return _font;
+			}
+			set
+			{
+				if (!_font.Equals(value))
+				{
+					_font = value;
+					_isUnderline = _font.Underline;
+					_isStrikeout = _font.Strikeout;
+
+					//float zoom = base.GetZoom();
+					//_fontDraw = new Font(_font.FontFamily, _font.Size * zoom, _font.Style & (FontStyle.Regular | FontStyle.Bold | FontStyle.Italic));
+
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 是否自动文本换行
+		/// </summary>
+		public bool Wrap
+		{
+			get
+			{
+				return _wrap;
+			}
+			set
+			{
+				if (_wrap != value)
+				{
+					_wrap = value;
+					_clip = !_wrap;
+
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+        /// <summary>
+        /// 是否剪裁延伸到边框外侧的文本
+        /// </summary>
+        public bool Clip
+		{
+			get
+			{
+				_clip = !_wrap;
+				return _clip;
+			}
+		}
+
+		/// <summary>
+		/// 文本颜色
+		/// </summary>
+		public Color TextColor
+		{
+			get
+			{
+				return _textColor;
+			}
+			set
+			{
+				if (!_textColor.Equals(value))
+				{
+					_textColor = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本对齐方式
+		/// </summary>
+		public TextAlignment TextAlign
+		{
+			get
+			{
+				return _textAlign;
+			}
+			set
+			{
+				if (_textAlign != value)
+				{
+					_textAlign = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本垂直对齐方式
+		/// </summary>
+		public TextAlignment TextAlignVertical
+		{
+			get
+			{
+				return _textAlignVertical;
+			}
+			set
+			{
+				if (_textAlignVertical != value)
+				{
+					_textAlignVertical = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文字间隔
+		/// </summary>
+		public float CharacterSpace
+		{
+			get
+			{
+				return _characterSpace;
+			}
+			set
+			{
+				if (_characterSpace != value)
+				{
+					_characterSpace = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文字行间隔
+		/// </summary>
+		public float LineSpace
+		{
+			get
+			{
+				return _lineSpace;
+			}
+			set
+			{
+				if (_lineSpace != value)
+				{
+					_lineSpace = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 行文字数
+		/// </summary>
+		public int CharacterCount
+		{
+			get
+			{
+				return _characterCount;
+			}
+			set
+			{
+				if (_characterCount != value)
+				{
+					_characterCount = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本默认值
+		/// </summary>
+		public string DefaultValue
+		{
+			get
+			{
+				return _defaultValue;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_defaultValue))
+				{
+					_defaultValue = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// culture
+		/// </summary>
+		public string Culture
+		{
+			get
+			{
+				return _culture;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_culture))
+				{
+					_culture = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 文本项目名
+		/// </summary>
+		public string TextItemName
+		{
+			get
+			{
+				return _textItemName;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_textItemName))
+				{
+					_textItemName = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 默认项目名
+		/// </summary>
+		public string DefaultItemName
+		{
+			get
+			{
+				return _defaultItemName;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_defaultItemName))
+				{
+					_defaultItemName = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		///// <summary>
+		///// 数据源中的值
+		///// </summary>
+		//internal object DataValue
+		//{
+		//	get
+		//	{
+		//		return _dataValue;
+		//	}
+		//	set
+		//	{
+		//		if (value != _dataValue
+		//			|| (value != null && !value.Equals(_dataValue)))
+		//		{
+		//			_dataValue = value;
+		//		}
+		//	}
+		//}
+
+		///// <summary>
+		///// 打印数据源中的值
+		///// </summary>
+		//internal object PrintDataValue
+		//{
+		//	get
+		//	{
+		//		return _printDataValue;
+		//	}
+		//	set
+		//	{
+		//		if (value != _printDataValue
+		//			|| (value != null && !value.Equals(_printDataValue)))
+		//		{
+		//			_printDataValue = value;
+		//		}
+		//	}
+		//}
+
+		/// <summary>
+		/// 是否数据绑定
+		/// </summary>
+		internal bool IsDataBinding
+		{
+			get
+			{
+				return _isDataBinding;
+			}
+			set
+			{
+				_isDataBinding = value;
+			}
+		}
+
+		///// <summary>
+		///// 数据源字段
+		///// </summary>
+		//internal DataBoundField BoundField
+		//{
+		//	get
+		//	{
+		//		return _boundField;
+		//	}
+		//	set
+		//	{
+		//		_boundField = value;
+		//	}
+		//}
+
+		///// <summary>
+		///// 打印数据源字段
+		///// </summary>
+		//internal DataBoundField PrintBoundField
+		//{
+		//	get
+		//	{
+		//		return _printBoundField;
+		//	}
+		//	set
+		//	{
+		//		_printBoundField = value;
+		//	}
+		//}
+
+		///// <summary>
+		///// 绘制字体
+		///// </summary>
+		//internal Font FontDraw
+		//{
+		//	get
+		//	{
+		//		return _fontDraw;
+		//	}
+		//}
+
+		///// <summary>
+		///// 绘制文字间隔
+		///// </summary>
+		//internal float CharacterSpaceDraw
+		//{
+		//	get
+		//	{
+		//		return _characterSpaceDraw;
+		//	}
+		//}
+
+		///// <summary>
+		///// 绘制行间隔
+		///// </summary>
+		//internal float LineSpaceDraw
+		//{
+		//	get
+		//	{
+		//		return _lineSpaceDraw;
+		//	}
+		//}
+
+		/// <summary>
+		/// 项目ID
+		/// </summary>
+		public int TravelDocItemID
+		{
+			get
+			{
+				return _travelDocItemID;
+			}
+			set
+			{
+				if (_travelDocItemID != value)
+				{
+					_travelDocItemID = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+				if (0 < _travelDocItemID)
+				{
+					_isDataBinding = true;
+				}
+				else
+				{
+					_isDataBinding = false;
+				}
+			}
+		}
+
+        /// <summary>
+        /// 项目编码
+        /// </summary>
+        public string ItemCode
+        {
+            get
+            {
+                return this._itemCode;
+            }
+            set
+            {
+                if (this._itemCode != value)
+                {
+                    this._itemCode = value;
+                    
+                }
+                if (string.IsNullOrEmpty(this._itemCode))
+                {
+                    this._isDataBinding = false;
+                }
+                else
+                {
+                    this._isDataBinding = true;
+                }
+            }
+        }
+		
+		/// <summary>
+		/// 分类
+		/// </summary>
+		public int ItemRefClass
+		{
+			get
+			{
+				return _itemRefClass;
+			}
+			set
+			{
+				if (value != _itemRefClass)
+				{
+					_itemRefClass = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 项目类别
+		/// </summary>
+		public ItemStyle ItemStyle
+		{
+			get
+			{
+				return _itemStyle;
+			}
+			set
+			{
+				if (value != _itemStyle)
+				{
+					_itemStyle = value;
+                    //this._picCode = null;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 项目示例
+		/// </summary>
+		public string ItemSample
+		{
+			get
+			{
+				return _itemSample;
+			}
+			set
+			{
+				if (string.IsNullOrEmpty(value))
+				{
+					value = string.Empty;
+				}
+				if (!value.Equals(_itemSample))
+				{
+					_itemSample = value;
+					//if (Owner != null)
+					//{
+					//	Owner.SetItemChangedArgs(this, ItemChangeType.Modified);
+					//}
+				}
+			}
+		}
+
+		public bool PicColumn
+		{
+			get;
+			set;
+		}
+		public bool PicMargin
+		{
+			get;
+			set;
+		}
+		public bool FixedRatio
+		{
+			get;
+			set;
+		}
+        #endregion 属性
+
+        #region 构造函数
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        internal TextItem()
+            : this(ItemType.Text)
+        {
+        }
+
+        ///// <summary>
+        ///// 构造函数
+        ///// </summary>
+        //internal TextItem(LayoutBox box)
+        //	: this(box, ItemType.Text)
+        //{
+        //}
+
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        internal TextItem(/*LayoutBox box,*/ ItemType itemType)
+            : base(/*box, */itemType)
+		{
+			//_width = LayoutCommon.DefaultTextItemSizeWidth;
+			//_height = LayoutCommon.DefaultTextItemSizeHeight;
+			_displayValue = string.Empty;
+			_format = string.Empty;
+			_defaultValue = string.Empty;
+			//_font = LayoutCommon.DefaultItemFont;
+			//_fontDraw = LayoutCommon.DefaultItemFont;
+			_textColor = Color.Black;
+			_textAlign = TextAlignment.LeftOrTop;
+			_characterSpace = 0f;
+			_lineSpace = 0f;
+			_characterCount = 0;
+			//_dataValue = null;
+			//_text = string.Empty;
+			_itemRefClass = 0;
+			_itemStyle = ItemStyle.Other;
+
+			_isDataBinding = false;
+			//_boundField = new DataBoundField();
+			//_boundField.IsDataBound = false;
+			//_boundField.BoundFieldIndex = -1;
+			//_printBoundField = new DataBoundField();
+			//_printBoundField.IsDataBound = false;
+			//_printBoundField.BoundFieldIndex = -1;
+
+			//_defaultItemName = LayoutBox.ITEMNAME_FIX + ID;
+			_textItemName = _defaultItemName;
+		}
+		#endregion 构造函数
+
+		#region 函数
+		/// <summary>
+		/// 格式化数据源中的值
+		/// </summary>
+		private string FormatDataValue(object value)
+		{
+			string result = null;
+			if (value != null && value != DBNull.Value)
+			{
+				if (_itemStyle == ItemStyle.Date)
+				{
+					result = value.ToString();
+					DateTime dateTime;
+					if (DateTime.TryParse(result, out dateTime))
+					{
+						if (string.IsNullOrEmpty(_format))
+						{
+							result = dateTime.ToString(LayoutConsts.DATETIME_FRORMAT);
+						}
+						else
+						{
+							//if (LayoutConsts.CULTUREINFO_JP.Equals(_culture))
+							//{
+							//	result = dateTime.ToString(_format, LayoutCommon.CultureInfoJP);
+							//}
+							//else
+							//{
+								// MMM
+								if (_format.Contains(LayoutConsts.DATETIME_FRORMAT_MMM))
+								{
+									if (string.IsNullOrEmpty(_culture))
+									{
+										result = dateTime.ToString(_format).ToUpper();
+									}
+									else
+									{
+										result = dateTime.ToString(_format, CultureInfo.CreateSpecificCulture(_culture)).ToUpper();
+									}
+								}
+								else if (string.IsNullOrEmpty(_culture))
+								{
+									result = dateTime.ToString(_format);
+								}
+								else
+								{
+									result = dateTime.ToString(_format, CultureInfo.CreateSpecificCulture(_culture));
+								}
+							//}
+						}
+					}
+				}
+				else if (_itemStyle == ItemStyle.Sign)
+				{
+					if (string.IsNullOrEmpty(_format))
+					{
+						result = value.ToString();
+					}
+					else
+					{
+						result = _format;
+					}
+				}
+				else
+				{
+					result = value.ToString();
+				}
+			}
+			return result;
+		}
+
+        /// <summary>
+        /// 文本内容设置
+        /// </summary>
+        public object ResetTextValue(object value, bool isDataBound)
+		{
+			//if (Owner == null)
+			//{
+			//	return _displayValue;
+			//}
+			//if (Owner.LayoutMode == LayoutMode.Preview)
+			{
+				if (!string.IsNullOrEmpty(_dataMember))
+				{
+					if (isDataBound)
+					{
+                        //object result = value;//Owner.SetItemValueFormattingArgs(this, value, _format);
+						if (PicColumn)
+						{
+							//if (result != null && result is Image)
+							//{
+							//	return result;
+							//}
+							if (value != null && value is byte[])
+							{
+                                using (MemoryStream ms = new MemoryStream(value as byte[]))
+                                {
+                                    return Image.FromStream(ms);
+                                }
+							}
+							return value;
+						}
+						//if (result != null)
+						//{
+						//	return result.ToString();
+						//}
+						if (value != null && value != DBNull.Value)
+						{
+							return FormatDataValue(value);
+						}
+						return _defaultValue;
+					}
+					//return _defaultValue;
+					return "";
+				}
+				return _displayValue;
+            }
+            //else
+            //{
+            //	//object result = Owner.SetItemValueFormattingArgs(this, value, _format);
+            //	object result = Owner.SetItemValueFormattingArgs(this, _displayValue, _format);
+            //	if (result != null)
+            //	{
+            //		return result.ToString();
+            //	}
+            //	return _displayValue;
+            //}
+        }
+
+		/// <summary>
+		/// Item初始化
+		/// </summary>
+		/// <param name="box">LayoutBox</param>
+		/// <param name="isNewID">是否生成新ID</param>
+		/// <returns>是否成功</returns>
+		internal override bool Init(/*LayoutBox box, bool isNewID*/)
+		{
+			//if (_fontDraw == null)
+			//{
+			//	if (_font == null)
+			//	{
+			//		_font = LayoutCommon.DefaultItemFont;
+			//		_fontDraw = LayoutCommon.DefaultItemFont;
+			//	}
+			//	else
+			//	{
+			//		_fontDraw = new Font(_font.FontFamily, _font.Size, _font.Style & (FontStyle.Regular | FontStyle.Bold | FontStyle.Italic));
+			//	}
+			//}
+			//_boundField.IsDataBound = false;
+			//_boundField.BoundFieldIndex = -1;
+			//_printBoundField.IsDataBound = false;
+			//_printBoundField.BoundFieldIndex = -1;
+
+			bool isInit = base.Init(/*box, isNewID*/);
+			//if (isNewID)
+			//{
+			//	_defaultItemName = LayoutBox.ITEMNAME_FIX + ID;
+			//	_textItemName = _defaultItemName;
+			//}
+			return isInit;
+		}
+
+        ///// <summary>
+        ///// Item图形上的OnPaint事件
+        ///// </summary>
+        ///// <param name="sender">指定的对象</param>
+        ///// <param name="e">提供的事件数据</param>
+        //protected override void OnPaint(object sender, PaintEventArgs e)
+        //{
+        //	DrawTextItem(_dataValue, _boundField, e.Graphics, RectangleFDraw, _marginRectangleFDraw);
+        //}
+
+        //private void DrawTextItem(object date, DataBoundField dataBoundField, Graphics graphics, RectangleF rectangleM, RectangleF rectangle)
+        //{
+        //	object value = ResetTextValue(date, dataBoundField.IsDataBound);
+        //	if (value == null)
+        //	{
+        //		return;
+        //	}
+        //	if (PicColumn && value is Image)
+        //	{
+        //		Image image = value as Image;
+        //		if (image != null)
+        //		{
+        //			RectangleF rfp = PicMargin ? rectangle : rectangleM;
+        //			if (FixedRatio)
+        //			{
+        //				// 背景图片的高宽比例
+        //				float imgWHRate = (float)image.Width / (float)image.Height;
+        //				// 打印纸张的高宽比例
+        //				float paperWHRate = rfp.Width / rfp.Height;
+
+        //				// 背景图片打印范围
+        //				RectangleF newImgRectangleF = RectangleF.Empty;
+
+        //				// 缩放背景图片,但保持图片高宽比例
+        //				if (imgWHRate > paperWHRate)
+        //				{
+        //					newImgRectangleF.Width = rfp.Width;
+        //					newImgRectangleF.Height = rfp.Width / imgWHRate;
+        //					newImgRectangleF.X = rfp.X;
+        //					newImgRectangleF.Y = (rfp.Height - newImgRectangleF.Height) / 2 + rfp.Y;
+        //				}
+        //				else
+        //				{
+        //					newImgRectangleF.Width = rfp.Height * imgWHRate;
+        //					newImgRectangleF.Height = rfp.Height;
+        //					newImgRectangleF.X = (rfp.Width - newImgRectangleF.Width) / 2 + rfp.X;
+        //					newImgRectangleF.Y = rfp.Y;
+        //				}
+        //				rfp = newImgRectangleF;
+        //			}
+        //			// 在指定的范围绘制背景图片
+        //			LayoutUtility.DrawImage(graphics, GraphicsUnit.Millimeter, rfp, image);
+        //		}
+        //		return;
+        //	}
+
+        //	LayoutUtility.DrawText(graphics,
+        //							GraphicsUnit.Millimeter,
+        //							rectangleM,
+        //							rectangle,
+        //							value.ToString(),
+        //							_fontDraw,
+        //							_textColor,
+        //							_lineSpaceDraw,
+        //							_characterSpaceDraw,
+        //							_characterCount,
+        //							_textAlign,
+        //							_textAlignVertical,
+        //							_wrap,
+        //							Clip,
+        //							Selected);
+        //}
+
+        public void PrintTextItem(object date, Graphics graphics, RectangleF rectangleM, RectangleF rectangle)
+		{
+			object value = ResetTextValue(date, true);
+			if (value == null)
+			{
+				return;
+			}
+            //bool isPrint = true;
+            try
+            {
+                if (this._itemStyle == ItemStyle.Barcode)
+                {
+                    OneDDrawingOptions ops = new OneDDrawingOptions();
+                    ops.DrawGraphics = graphics;
+                    graphics.PageUnit = GraphicsUnit.Pixel;
+                    Rectangle imageRect = new Rectangle(
+                        LayoutCommon.MillimeterToPixel(rectangleM.Left, graphics.DpiX),
+                        LayoutCommon.MillimeterToPixel(rectangleM.Top, graphics.DpiX),
+                        LayoutCommon.MillimeterToPixel(rectangleM.Width, graphics.DpiX),
+                        LayoutCommon.MillimeterToPixel(rectangleM.Height, graphics.DpiX));
+                    BarcodeDraw.DrawOneDImageOnGraphics(value.ToString(), imageRect, ops);
+                    graphics.PageUnit = GraphicsUnit.Millimeter;
+                    //Image pic = null;
+                    //if (!isPrint && this.SimpleShape.Width == this._picCodeWidth &&
+                    //    this.SimpleShape.Height == this._picCodeHeight &&
+                    //    value.ToString() == _picCodeValue)
+                    //{
+                    //    pic = this._picCode;
+                    //}
+                    //int Width = LayoutCommon.MillimeterToPixel(rectangleM.Width, graphics.DpiX);
+                    //int Height = LayoutCommon.MillimeterToPixel(rectangleM.Height, graphics.DpiY);
+                    //int Width = LayoutCommon.MillimeterToPixel(rectangleM.Width, 96);
+                    //int Height = LayoutCommon.MillimeterToPixel(rectangleM.Height, 96);
+                    //if (pic == null)
+                    //{
+                    //    //OneDData qrd = OneDHelper.Encode(value.ToString(), Width, Height, BarcodeMargin.Empty);
+                    //    //OneDDrawingOptions ops = new OneDDrawingOptions();
+                    //    //ops.DrawGraphics = graphics;
+                    //    //ops.i
+                    //    //pic = OneDHelper.DrawOneDImage(qrd, ops);
+
+                    //    //BarcodeWriter writer = new BarcodeWriter();
+                    //    //EncodingOptions options = new EncodingOptions()
+                    //    //{
+                    //    //    PureBarcode = true,
+                    //    //    Margin = 0,
+                    //    //};
+                    //    //writer.Options = options;
+                    //    //writer.Format = BarcodeFormat.CODE_128;
+                    //    ////writer.Options.ErrorCorrection = ErrorCorrectionLevel.H;
+                    //    ////writer.Options.Width = this.SimpleShape.Width;
+                    //    ////writer.Options.Height = this.SimpleShape.Height;
+                    //    //writer.Options.Width = Width;
+                    //    //writer.Options.Height = Height;
+                    //    //pic = writer.Write(value.ToString());
+                    //    ////if (!isPrint)
+                    //    ////{
+                    //    ////    this._picCode = pic;
+                    //    ////    _picCodeValue = value.ToString();
+                    //    ////    _picCodeWidth = this.SimpleShape.Width;
+                    //    ////    _picCodeHeight = this.SimpleShape.Height;
+                    //    ////}
+                    //}
+
+                    //try
+                    //{
+                    //    if (pic != null)
+                    //    {
+                    //        //LayoutUtility.DrawImage(graphics, GraphicsUnit.Millimeter, rectangleM, pic);
+                    //        graphics.DrawImage(pic, rectangleM);
+                    //    }
+                    //}
+                    //catch
+                    //{
+                    //}
+                    //finally
+                    //{
+                    //    if (pic != null && isPrint)
+                    //    {
+                    //        pic.Dispose();
+                    //    }
+                    //}
+                    return;
+                }
+                if (this._itemStyle == ItemStyle.QRCode)
+                {
+                    QRCodeDrawingOptions ops = new QRCodeDrawingOptions();
+                    ops.DrawGraphics = graphics;
+                    graphics.PageUnit = GraphicsUnit.Pixel;
+                    Rectangle imageRect = new Rectangle(
+                        LayoutCommon.MillimeterToPixel(rectangleM.Left, graphics.DpiX),
+                        LayoutCommon.MillimeterToPixel(rectangleM.Top, graphics.DpiX),
+                        LayoutCommon.MillimeterToPixel(rectangleM.Width, graphics.DpiX),
+                        LayoutCommon.MillimeterToPixel(rectangleM.Height, graphics.DpiX));
+                    BarcodeDraw.DrawQRCodeImageOnGraphics(value.ToString(), imageRect, ops);
+                    graphics.PageUnit = GraphicsUnit.Millimeter;
+                    //Image pic = null;
+                    ////if (!isPrint && this.SimpleShape.Width == this._picCodeWidth &&
+                    ////    this.SimpleShape.Height == this._picCodeHeight &&
+                    ////    value.ToString() == _picCodeValue)
+                    ////{
+                    ////    pic = this._picCode;
+                    ////}
+
+                    //int Width = LayoutCommon.MillimeterToPixel(rectangleM.Width, graphics.DpiX);
+                    //int Height = LayoutCommon.MillimeterToPixel(rectangleM.Height, graphics.DpiY);
+                    ////int Width = LayoutCommon.MillimeterToPixel(rectangleM.Width, 96);
+                    ////int Height = LayoutCommon.MillimeterToPixel(rectangleM.Height, 96);
+                    //if (pic == null)
+                    //{
+                    //    QRCodeData qrd = QRCodeHelper.Encode(value.ToString(), Width, Height, BarcodeMargin.Empty);
+                    //    QRCodeDrawingOptions ops = new QRCodeDrawingOptions();
+                    //    ops.DrawGraphics = graphics;
+                    //    pic = QRCodeHelper.DrawQRDataImage(qrd, ops);
+                    //    if (this.Wrap)
+                    //    {
+                    //        // 缩放图片
+                    //        //QRCodeEncodingOptions options = new QRCodeEncodingOptions();
+                    //        //options.ECLevel = QRECLevel.H;
+                    //        //QRCodeData qrd = QRCodeHelper.Encode(value.ToString(),
+                    //        //    Width,
+                    //        //    Height,
+                    //        //    BarcodeMargin.Empty, options);
+                    //        //QRCodeDrawingOptions options1 = new QRCodeDrawingOptions();
+                    //        //options1.DrawGraphics = graphics;
+                    //        //options1.DpiX = graphics.DpiX;
+                    //        //options1.DpiY = graphics.DpiY;
+                    //        ////qrd.QRWidth = this.SimpleShape.Width;
+                    //        ////qrd.QRHeight = this.SimpleShape.Height;
+                    //        //pic = QRCodeHelper.DrawQRDataImage(qrd, options1);
+                    //    }
+                    //    else
+                    //    {
+                    //        //BarcodeWriter writer = new BarcodeWriter();
+                    //        //QrCodeEncodingOptions options = new QrCodeEncodingOptions();
+                    //        //options.DisableECI = true;
+                    //        ////设置内容编码
+                    //        ////options.CharacterSet = "UTF-8";
+                    //        ////options.QrVersion = 3;
+                    //        //options.ErrorCorrection = ErrorCorrectionLevel.H;
+                    //        ////设置二维码的宽度和高度
+                    //        //options.Width = Width;
+                    //        //options.Height = Height;
+                    //        ////设置二维码的边距,单位不是固定像素
+                    //        //options.Margin = 0;
+                    //        //writer.Encoder = new QRCodeWriterMy();
+                    //        //writer.Options = options;
+                    //        //writer.Format = BarcodeFormat.QR_CODE;
+
+                    //        //pic = writer.Write(value.ToString());
+                    //    }
+                    //    //if (!isPrint)
+                    //    //{
+                    //    //    this._picCode = pic;
+                    //    //    _picCodeValue = value.ToString();
+                    //    //    _picCodeWidth = this.SimpleShape.Width;
+                    //    //    _picCodeHeight = this.SimpleShape.Height;
+                    //    //}
+                    //}
+                    //try
+                    //{
+                    //    if (pic != null)
+                    //    {
+                    //        //LayoutUtility.DrawImage(graphics, GraphicsUnit.Millimeter, rectangleM, pic);
+                    //        graphics.DrawImage(pic, rectangleM);
+                    //    }
+                    //}
+                    //catch
+                    //{
+                    //}
+                    //finally
+                    //{
+                    //    if (pic != null && isPrint)
+                    //    {
+                    //        pic.Dispose();
+                    //    }
+                    //}
+                    return;
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            if (PicColumn && value is Image)
+			{
+				Image image = value as Image;
+				if (image != null)
+				{
+					RectangleF rfp = PicMargin ? rectangle : rectangleM;
+					if (FixedRatio)
+					{
+						// 背景图片的高宽比例
+						float imgWHRate = (float)image.Width / (float)image.Height;
+						// 打印纸张的高宽比例
+						float paperWHRate = rfp.Width / rfp.Height;
+
+						// 背景图片打印范围
+						RectangleF newImgRectangleF = RectangleF.Empty;
+
+						// 缩放背景图片,但保持图片高宽比例
+						if (imgWHRate > paperWHRate)
+						{
+							newImgRectangleF.Width = rfp.Width;
+							newImgRectangleF.Height = rfp.Width / imgWHRate;
+							newImgRectangleF.X = rfp.X;
+							newImgRectangleF.Y = (rfp.Height - newImgRectangleF.Height) / 2 + rfp.Y;
+						}
+						else
+						{
+							newImgRectangleF.Width = rfp.Height * imgWHRate;
+							newImgRectangleF.Height = rfp.Height;
+							newImgRectangleF.X = (rfp.Width - newImgRectangleF.Width) / 2 + rfp.X;
+							newImgRectangleF.Y = rfp.Y;
+						}
+						rfp = newImgRectangleF;
+					}
+					// 在指定的范围绘制背景图片
+					LayoutUtility.DrawImage(graphics, GraphicsUnit.Millimeter, rfp, image);
+				}
+				return;
+			}
+
+			LayoutUtility.DrawText(graphics,
+									GraphicsUnit.Millimeter,
+									rectangleM,
+									rectangle,
+									value.ToString(),
+									_font,
+									_textColor,
+									_lineSpace,
+									_characterSpace,
+									_characterCount,
+									_textAlign,
+									_textAlignVertical,
+									_wrap,
+									Clip,
+									false);
+		}
+		#endregion 函数
+
+        public Image pictureProcess(Image sourceImage, int targetWidth, int targetHeight)
+        {
+            int width;//图片最终的宽  
+            int height;//图片最终的高  
+            try
+            {
+                System.Drawing.Imaging.ImageFormat format = sourceImage.RawFormat;
+                Bitmap targetPicture = new Bitmap(targetWidth, targetHeight);
+                Graphics g = Graphics.FromImage(targetPicture);
+                g.Clear(Color.White);
+
+                //计算缩放图片的大小  
+                if (sourceImage.Width > targetWidth && sourceImage.Height <= targetHeight)
+                {
+                    width = targetWidth;
+                    height = (width * sourceImage.Height) / sourceImage.Width;
+                }
+                else if (sourceImage.Width <= targetWidth && sourceImage.Height > targetHeight)
+                {
+                    height = targetHeight;
+                    width = (height * sourceImage.Width) / sourceImage.Height;
+                }
+                else if (sourceImage.Width <= targetWidth && sourceImage.Height <= targetHeight)
+                {
+                    width = sourceImage.Width;
+                    height = sourceImage.Height;
+                }
+                else
+                {
+                    width = targetWidth;
+                    height = (width * sourceImage.Height) / sourceImage.Width;
+                    if (height > targetHeight)
+                    {
+                        height = targetHeight;
+                        width = (height * sourceImage.Width) / sourceImage.Height;
+                    }
+                }
+                g.DrawImage(sourceImage, (targetWidth - width) / 2, (targetHeight - height) / 2, width, height);
+                sourceImage.Dispose();
+
+                return targetPicture;
+            }
+            catch// (Exception ex)
+            {
+
+            }
+            return null;
+        }  
+    }
+
+    public class QRCodeWriterMy : Writer
+    {
+        private const int QUIET_ZONE_SIZE = 4;
+
+        /// <summary>
+        /// Encode a barcode using the default settings.
+        /// </summary>
+        /// <param name="contents">The contents to encode in the barcode</param>
+        /// <param name="format">The barcode format to generate</param>
+        /// <param name="width">The preferred width in pixels</param>
+        /// <param name="height">The preferred height in pixels</param>
+        /// <returns>
+        /// The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white)
+        /// </returns>
+        public BitMatrix encode(string contents, BarcodeFormat format, int width, int height)
+        {
+            return encode(contents, format, width, height, null);
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="contents">The contents to encode in the barcode</param>
+        /// <param name="format">The barcode format to generate</param>
+        /// <param name="width">The preferred width in pixels</param>
+        /// <param name="height">The preferred height in pixels</param>
+        /// <param name="hints">Additional parameters to supply to the encoder</param>
+        /// <returns>
+        /// The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white)
+        /// </returns>
+        public BitMatrix encode(string contents,
+                                BarcodeFormat format,
+                                int width,
+                                int height,
+                                IDictionary<EncodeHintType, object> hints)
+        {
+            if (String.IsNullOrEmpty(contents))
+            {
+                throw new ArgumentException("Found empty contents");
+            }
+
+            if (format != BarcodeFormat.QR_CODE)
+            {
+                throw new ArgumentException("Can only encode QR_CODE, but got " + format);
+            }
+
+            if (width < 0 || height < 0)
+            {
+                throw new ArgumentException("Requested dimensions are too small: " + width + 'x' + height);
+            }
+
+            var errorCorrectionLevel = ErrorCorrectionLevel.L;
+            int quietZone = QUIET_ZONE_SIZE;
+            if (hints != null)
+            {
+                if (hints.ContainsKey(EncodeHintType.ERROR_CORRECTION))
+                {
+                    var requestedECLevel = hints[EncodeHintType.ERROR_CORRECTION];
+                    if (requestedECLevel != null)
+                    {
+                        errorCorrectionLevel = requestedECLevel as ErrorCorrectionLevel;
+                        if (errorCorrectionLevel == null)
+                        {
+                            switch (requestedECLevel.ToString().ToUpper())
+                            {
+                                case "L":
+                                    errorCorrectionLevel = ErrorCorrectionLevel.L;
+                                    break;
+                                case "M":
+                                    errorCorrectionLevel = ErrorCorrectionLevel.M;
+                                    break;
+                                case "Q":
+                                    errorCorrectionLevel = ErrorCorrectionLevel.Q;
+                                    break;
+                                case "H":
+                                    errorCorrectionLevel = ErrorCorrectionLevel.H;
+                                    break;
+                                default:
+                                    errorCorrectionLevel = ErrorCorrectionLevel.L;
+                                    break;
+                            }
+                        }
+                    }
+                }
+                if (hints.ContainsKey(EncodeHintType.MARGIN))
+                {
+                    var quietZoneInt = hints[EncodeHintType.MARGIN];
+                    if (quietZoneInt != null)
+                    {
+                        quietZone = Convert.ToInt32(quietZoneInt.ToString());
+                    }
+                }
+            }
+
+            var code = Encoder.encode(contents, errorCorrectionLevel, hints);
+            BitMatrix bm = renderResult(code, width, height, quietZone);
+            hints[EncodeHintType.WIDTH] = bm.Width;
+            hints[EncodeHintType.HEIGHT] = bm.Height;
+            return bm;
+        }
+
+        // Note that the input matrix uses 0 == white, 1 == black, while the output matrix uses
+        // 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
+        private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone)
+        {
+            var input = code.Matrix;
+            if (input == null)
+            {
+                throw new InvalidOperationException();
+            }
+            int inputWidth = input.Width;
+            int inputHeight = input.Height;
+            int qrWidth = inputWidth + (quietZone << 1);
+            int qrHeight = inputHeight + (quietZone << 1);
+            int outputWidth = Math.Max(width, qrWidth);
+            int outputHeight = Math.Max(height, qrHeight);
+
+            int multiple = Math.Min(outputWidth / qrWidth, outputHeight / qrHeight);
+            // Padding includes both the quiet zone and the extra white pixels to accommodate the requested
+            // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
+            // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
+            // handle all the padding from 100x100 (the actual QR) up to 200x160.
+            int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
+            int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
+
+            //int leftPadding = 0;//(outputWidth - (inputWidth * multiple)) / 2;
+            //int topPadding = 0;//(outputHeight - (inputHeight * multiple)) / 2;
+            //outputWidth = (inputWidth * multiple);
+            //outputHeight = (inputHeight * multiple);
+
+            var output = new BitMatrix(outputWidth, outputHeight);
+
+            for (int inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple)
+            {
+                // Write the contents of this row of the barcode
+                for (int inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple)
+                {
+                    if (input[inputX, inputY] == 1)
+                    {
+                        output.setRegion(outputX, outputY, multiple, multiple);
+                        //int mX = outputWidth - outputX;
+                        //int mY = outputHeight - outputY;
+                        //mX = Math.Min(mX, multiple);
+                        //mY = Math.Min(mY, multiple);
+                        //output.setRegion(outputX, outputY, mX, mY);
+                    }
+                }
+            }
+
+            return output;
+        }
+    }
+}

+ 36 - 0
DK.Service/InvoiceLayout/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("InvoiceLayout")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("InvoiceLayout")]
+[assembly: AssemblyCopyright("Copyright ©  2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("440b03e6-474c-439a-af83-900a01a57abe")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

二進制
DLL/Curtain.DataAccess.dll


二進制
DLL/Curtain.Framework.dll


二進制
DLL/Curtain.Net.Sockets.dll


+ 1359 - 0
DLL/Curtain.Net.Sockets.xml

@@ -0,0 +1,1359 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>Curtain.Net.Sockets</name>
+    </assembly>
+    <members>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.ServerMessageType">
+            <summary>
+            服务端事件消息类型
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.ServerMessageType.Error">
+            <summary>
+            错误异常
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.ServerMessageType.Warning">
+            <summary>
+            警告
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.ServerMessageType.Trace">
+            <summary>
+            跟踪
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.ServerMessageType.Debug">
+            <summary>
+            调试
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.ServerMessageEventHandler">
+            <summary>
+            服务端消息事件
+            </summary>
+            <param name="sender"></param>
+            <param name="e"></param>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs">
+            <summary>
+            服务端消息事件参数
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs.Type">
+            <summary>
+            消息类型
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs.Client">
+            <summary>
+            Socket客户端
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs.Server">
+            <summary>
+            Socket服务端
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs.Code">
+            <summary>
+            消息代码
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs.Message">
+            <summary>
+            消息内容
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs.Exception">
+            <summary>
+            系统异常信息
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs.#ctor">
+            <summary>
+            服务端消息事件参数
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs.ToString">
+            <summary>
+            ToString
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.ServerSession">
+            <summary>
+            服务端Session
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerSession.ID">
+            <summary>
+            SessionID
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerSession.IPEndPoint">
+            <summary>
+            此连接对象连接的远程客户端
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerSession.IPAddress">
+            <summary>
+            IP地址
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerSession.IP">
+            <summary>
+            服务端IP
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerSession.Port">
+            <summary>
+            服务端端口
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerSession.Backlog">
+            <summary>
+            挂起连接队列的最大长度
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerSession.Socket">
+            <summary>
+            传输数据的对象
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerSession.Clear">
+            <summary>
+            清除Session
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerSession.ToString">
+            <summary>
+            ToString
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.ClientSession">
+            <summary>
+            客户端Session
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ClientSession.ID">
+            <summary>
+            SessionID
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ClientSession.Server">
+            <summary>
+            服务端Session
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ClientSession.Socket">
+            <summary>
+            传输数据的对象
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ClientSession.IPEndPoint">
+            <summary>
+            此连接对象连接的远程客户端
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ClientSession.IPAddress">
+            <summary>
+            IP地址
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ClientSession.IP">
+            <summary>
+            客户端IP
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ClientSession.Port">
+            <summary>
+            客户端端口
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ClientSession.Clear">
+            <summary>
+            清除Session
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ClientSession.ToString">
+            <summary>
+            ToString
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.ReceiveSession">
+            <summary>
+            数据接收Session
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ReceiveSession.ID">
+            <summary>
+            SessionID
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ReceiveSession.Client">
+            <summary>
+            客户端Session
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ReceiveSession.Head">
+            <summary>
+            响应报文-头
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ReceiveSession.Content">
+            <summary>
+            响应报文-文本
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.ReceiveSession.HeadBytes">
+            <summary>
+            响应报文-头
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.ReceiveSession.ContentBytes">
+            <summary>
+            响应报文-文本
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ReceiveSession.Command">
+            <summary>
+            报文命令
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ReceiveSession.Offset">
+            <summary>
+            已接收数据长度
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ReceiveSession.Size">
+            <summary>
+            总接收数据长度
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ReceiveSession.Clear">
+            <summary>
+            清除Session
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ReceiveSession.ToString">
+            <summary>
+            ToString
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.TimeoutSocket">
+            <summary>
+            扩展Socket,接收数据超时功能
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.TimeoutSocket.BeginReceiveByTimeout(System.Net.Sockets.Socket,System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.AsyncCallback,System.AsyncCallback,System.Int32,System.Object)">
+            <summary>
+            开始从连接的 System.Net.Sockets.Socket 中异步接收数据(超时后关闭连接的Socket)。
+            </summary>
+            <param name="socket"></param>
+            <param name="buffer"></param>
+            <param name="offset"></param>
+            <param name="size"></param>
+            <param name="socketFlags"></param>
+            <param name="callback"></param>
+            <param name="timeoutCallback"></param>
+            <param name="timeout"></param>
+            <param name="state"></param>
+            <returns></returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.StateInfo">
+            <summary>
+            异步接收数据,超时时回调事件状态
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.StateInfo.#ctor(System.Net.Sockets.Socket,System.AsyncCallback,System.AsyncCallback,System.Object)">
+            <summary>
+            异步接收数据,超时时回调事件状态
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.StateInfo.SetTimeout">
+            <summary>
+            超时后执行回调
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.PLCMessageType">
+            <summary>
+            PLC报文类型
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.PLCMessageType.Send">
+            <summary>
+            发送命令
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.PLCMessageType.Read">
+            <summary>
+            读取PLC
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.PLCMessageType.Write">
+            <summary>
+            写入PLC
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.PLCMessage">
+            <summary>
+            PLC报文
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCMessage.#ctor">
+            <summary>
+            PLC报文
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCMessage.#ctor(Curtain.Net.Sockets.PLC.Core.PLCMessageType)">
+            <summary>
+            PLC报文
+            </summary>
+            <param name="messageType">报文类型</param>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Host">
+            <summary>
+            主机地址
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Port">
+            <summary>
+            主机端口
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.MessageType">
+            <summary>
+            报文类型
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Code">
+            <summary>
+            PLC软元件代码
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Number">
+            <summary>
+            PLC软元件编码
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Length">
+            <summary>
+            PLC软元件点数
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Value">
+            <summary>
+            读取或写入值
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Command">
+            <summary>
+            命令报文
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Head">
+            <summary>
+            响应报文-头
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.Content">
+            <summary>
+            响应报文-文本
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCMessage.PLCError">
+            <summary>
+            PLC处理是否返回错误
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.PLCMessage.CommandBytes">
+            <summary>
+            命令报文
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.PLCMessage.HeadBytes">
+            <summary>
+            响应报文-头
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.PLCMessage.ContentBytes">
+            <summary>
+            响应报文-文本
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.ISocketModel">
+            <summary>
+            SocketModel
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ISocketModel.ReceiveTimeout">
+            <summary>
+            接收通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ISocketModel.SendTimeout">
+            <summary>
+            发送通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ISocketModel.HeadLength">
+            <summary>
+            响应报文-头长度
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.IPLCModel">
+            <summary>
+            PLC通信模型
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IPLCModel.GetContentLength(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            根据响应报文-头,计算响应报文-文本长度
+            </summary>
+            <param name="m">报文</param>
+            <returns>响应报文-文本长度</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IPLCModel.CheckHead(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            验证响应报文-头
+            </summary>
+            <param name="m">报文</param>
+            <returns>是否通过</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IPLCModel.ToSendFromCommand(System.String)">
+            <summary>
+            命令报文转换为发送字节
+            </summary>
+            <param name="command">命令报文</param>
+            <returns>发送字节</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IPLCModel.ToResponseFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为响应报文
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IPLCModel.SetValueFromResponse(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            根据响应报文设置读取值
+            </summary>
+            <param name="m">报文</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IPLCModel.GetReadMessage(System.Char,System.Int32,System.Int32)">
+            <summary>
+            获取读取命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IPLCModel.GetWriteMessage(System.Char,System.Int32,System.Int32)">
+            <summary>
+            获取写入命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="value"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IPLCModel.GetWriteMessage(System.Char,System.Int32,System.String,System.Int32)">
+            <summary>
+            获取写入命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="value"></param>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.PLCModel">
+            <summary>
+            PLC通信模型
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.CreateModel``1">
+            <summary>
+            创建PLC通信模型
+            </summary>
+            <typeparam name="T"></typeparam>
+            <returns></returns>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCModel.ReceiveTimeout">
+            <summary>
+            接收通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCModel.SendTimeout">
+            <summary>
+            发送通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCModel.HeadLength">
+            <summary>
+            响应报文-头长度
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.GetContentLength(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            根据响应报文-头,计算响应报文-文本长度
+            </summary>
+            <param name="m">报文</param>
+            <returns>响应报文-文本长度</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.CheckHead(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            验证响应报文-头
+            </summary>
+            <param name="m">报文</param>
+            <returns>是否通过</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.ToSendFromCommand(System.String)">
+            <summary>
+            命令报文转换为发送字节
+            </summary>
+            <param name="command">命令报文</param>
+            <returns>发送字节</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.ToResponseFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为响应报文
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.SetValueFromResponse(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            根据响应报文设置读取值
+            </summary>
+            <param name="m">报文</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.GetReadMessage(System.Char,System.Int32,System.Int32)">
+            <summary>
+            获取读取命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.GetWriteMessage(System.Char,System.Int32,System.Int32)">
+            <summary>
+            获取写入命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="value"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCModel.GetWriteMessage(System.Char,System.Int32,System.String,System.Int32)">
+            <summary>
+            获取写入命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="value"></param>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.CommandFormatType.PLCCommand">
+            <summary>
+            PLC命令格式
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.Core.CommandFormatType.StartStopChar">
+            <summary>
+            起止符格式
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.IServerModel">
+            <summary>
+            服务端模型
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IServerModel.GetContentLength(Curtain.Net.Sockets.PLC.Core.ReceiveSession)">
+            <summary>
+            根据响应报文-头,计算响应报文-文本长度
+            </summary>
+            <param name="m">报文</param>
+            <returns>响应报文-文本长度</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IServerModel.CheckHead(Curtain.Net.Sockets.PLC.Core.ReceiveSession)">
+            <summary>
+            验证响应报文-头
+            </summary>
+            <param name="m">报文</param>
+            <returns>是否通过</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IServerModel.ToCommandFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为命令
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IServerModel.ToHeadFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为报文头
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IServerModel.ToContentFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为报文正文
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.IServerModel.ToSendFromCommand(System.String)">
+            <summary>
+            命令报文转换为发送字节
+            </summary>
+            <param name="command">命令报文</param>
+            <returns>发送字节</returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.ServerModel">
+            <summary>
+            服务端模型
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerModel.CreateModel``1">
+            <summary>
+            创建服务端模型
+            </summary>
+            <typeparam name="T"></typeparam>
+            <returns></returns>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerModel.ReceiveTimeout">
+            <summary>
+            接收通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerModel.SendTimeout">
+            <summary>
+            发送通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.ServerModel.HeadLength">
+            <summary>
+            响应报文-头长度
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerModel.GetContentLength(Curtain.Net.Sockets.PLC.Core.ReceiveSession)">
+            <summary>
+            根据响应报文-头,计算响应报文-文本长度
+            </summary>
+            <param name="m">报文</param>
+            <returns>响应报文-文本长度</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerModel.CheckHead(Curtain.Net.Sockets.PLC.Core.ReceiveSession)">
+            <summary>
+            验证响应报文-头
+            </summary>
+            <param name="m">报文</param>
+            <returns>是否通过</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerModel.ToCommandFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为命令
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerModel.ToHeadFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为报文头
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerModel.ToContentFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为报文正文
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.ServerModel.ToSendFromCommand(System.String)">
+            <summary>
+            命令报文转换为发送字节
+            </summary>
+            <param name="command">命令报文</param>
+            <returns>发送字节</returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.PLCResult">
+            <summary>
+            返回结果
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCResult.Successed">
+            <summary>
+            方法成功
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCResult.Message">
+            <summary>
+            消息
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCResult.MessageDetail">
+            <summary>
+            消息明细
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCResult.#ctor">
+            <summary>
+            返回结果
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCResult.#ctor(Curtain.Net.Sockets.PLC.Core.PLCResult)">
+            <summary>
+            返回结果
+            </summary>
+            <param name="result">返回结果</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCResult.SetValue(Curtain.Net.Sockets.PLC.Core.PLCResult)">
+            <summary>
+            设置返回结果
+            </summary>
+            <param name="result">返回结果</param>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.PLCResult`1">
+            <summary>
+            返回结果
+            </summary>
+            <typeparam name="T">扩展数据</typeparam>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.PLCResult`1.Data">
+            <summary>
+            扩展数据
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCResult`1.#ctor">
+            <summary>
+            返回结果
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCResult`1.#ctor(Curtain.Net.Sockets.PLC.Core.PLCResult)">
+            <summary>
+            返回结果
+            </summary>
+            <param name="result">返回结果</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCResult`1.#ctor(`0)">
+            <summary>
+            返回结果
+            </summary>
+            <param name="data">扩展数据</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Core.PLCResult`1.#ctor(Curtain.Net.Sockets.PLC.Core.PLCResult,`0)">
+            <summary>
+            返回结果
+            </summary>
+            <param name="result">返回结果</param>
+            <param name="data">扩展数据</param>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Core.SocketAsyncState">
+            <summary>
+            Socket异步状态
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.SocketAsyncState.Data">
+            <summary>
+            数据
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.SocketAsyncState.Offset">
+            <summary>
+            数据偏移
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.SocketAsyncState.Size">
+            <summary>
+            数据大小
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Core.SocketAsyncState.Result">
+            <summary>
+            结果
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel">
+            <summary>
+            三菱Melsec MC协议通信 A兼容 1E结构 ASCII码
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.HeadLength">
+            <summary>
+            响应报文-头长度
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.GetContentLength(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            根据响应报文-头,计算响应报文-文本长度
+            </summary>
+            <param name="m">报文</param>
+            <returns>响应报文-文本长度</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.CheckHead(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            验证响应报文-头
+            </summary>
+            <param name="m">报文</param>
+            <returns>是否通过</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.ToSendFromCommand(System.String)">
+            <summary>
+            命令报文转换为发送字节
+            </summary>
+            <param name="command">命令报文</param>
+            <returns>发送字节</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.ToResponseFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为响应报文
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.SetValueFromResponse(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            根据响应报文设置读取值
+            </summary>
+            <param name="m">报文</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.GetReadMessage(System.Char,System.Int32,System.Int32)">
+            <summary>
+            获取读取命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.GetWriteMessage(System.Char,System.Int32,System.Int32)">
+            <summary>
+            获取写入命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="value"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.MelsecA1EAsciiModel.GetWriteMessage(System.Char,System.Int32,System.String,System.Int32)">
+            <summary>
+            获取写入命令报文
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="value"></param>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.Model.SimpleSocketServerModel.HeadLength">
+            <summary>
+            响应报文-头长度
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.SimpleSocketServerModel.GetContentLength(Curtain.Net.Sockets.PLC.Core.ReceiveSession)">
+            <summary>
+            根据响应报文-头,计算响应报文-文本长度
+            </summary>
+            <param name="m">报文</param>
+            <returns>响应报文-文本长度</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.SimpleSocketServerModel.CheckHead(Curtain.Net.Sockets.PLC.Core.ReceiveSession)">
+            <summary>
+            验证响应报文-头
+            </summary>
+            <param name="m">报文</param>
+            <returns>是否通过</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.SimpleSocketServerModel.ToCommandFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为命令
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.SimpleSocketServerModel.ToHeadFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为报文头
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.SimpleSocketServerModel.ToContentFromReceive(System.Byte[])">
+            <summary>
+            接收字节转换为报文正文
+            </summary>
+            <param name="receive">接收字节</param>
+            <returns>响应报文</returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.Model.SimpleSocketServerModel.ToSendFromCommand(System.String)">
+            <summary>
+            命令报文转换为发送字节
+            </summary>
+            <param name="command">命令报文</param>
+            <returns>发送字节</returns>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.ServerSocket">
+            <summary>
+            Socket 服务端
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ServerSocket.OwnerForm">
+            <summary>
+            服务所在winform窗体(异步事件响应用)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ServerSocket.Started">
+            <summary>
+            服务状态
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ServerSocket.Model">
+            <summary>
+            服务端模型
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ServerSocket.ReceiveTimeout">
+            <summary>
+            通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ServerSocket.SendTimeout">
+            <summary>
+            通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="F:Curtain.Net.Sockets.PLC.ServerSocket._repeated">
+            <summary>
+            接收服务启动异常后自动重试次数
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ServerSocket.Repeated">
+            <summary>
+            接收服务启动异常后自动重试次数(默认3次,最大20次)
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.#ctor">
+            <summary>
+            Socket 服务端
+            </summary>
+        </member>
+        <member name="E:Curtain.Net.Sockets.PLC.ServerSocket.ServerStarting">
+            <summary>
+            服务启动前
+            </summary>
+        </member>
+        <member name="E:Curtain.Net.Sockets.PLC.ServerSocket.ServerStoping">
+            <summary>
+            服务启动后
+            </summary>
+        </member>
+        <member name="E:Curtain.Net.Sockets.PLC.ServerSocket.ServerStarted">
+            <summary>
+            服务停止前
+            </summary>
+        </member>
+        <member name="E:Curtain.Net.Sockets.PLC.ServerSocket.ServerStoped">
+            <summary>
+            服务停止后
+            </summary>
+        </member>
+        <member name="E:Curtain.Net.Sockets.PLC.ServerSocket.ServerMessage">
+            <summary>
+            服务端事件发生
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnServerStarting(System.ComponentModel.CancelEventArgs)">
+            <summary>
+            服务启动前
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnServerStoping(System.ComponentModel.CancelEventArgs)">
+            <summary>
+            服务启动后
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnServerStarted(System.EventArgs)">
+            <summary>
+            服务停止前
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnServerStoped(System.EventArgs)">
+            <summary>
+            服务停止后
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnServerMessage(Curtain.Net.Sockets.PLC.Core.ServerMessageEventArgs)">
+            <summary>
+            服务端事件发生
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.StartReceive(Curtain.Net.Sockets.PLC.Core.ClientSession)">
+            <summary>
+            开始接收
+            </summary>
+            <param name="cs"></param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.HeadReceiveCallback(System.IAsyncResult)">
+            <summary>
+            指令头接收方法
+            </summary>
+            <param name="ar">异步状态信息</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.ContentReceiveCallback(System.IAsyncResult)">
+            <summary>
+            数据内容接收方法
+            </summary>
+            <param name="ar"></param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnClientConnected(System.Object)">
+            <summary>
+            客户端上线
+            </summary>
+            <param name="obj">socket对象</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnReceiveException(Curtain.Net.Sockets.PLC.Core.ReceiveSession,System.Exception,System.Boolean)">
+            <summary>
+            服务接收异常
+            </summary>
+            <param name="rs"></param>
+            <param name="ex">异常信息</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnClientDown(Curtain.Net.Sockets.PLC.Core.ReceiveSession,System.Exception)">
+            <summary>
+            客户端下线
+            </summary>
+            <param name="rs"></param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnClientTimeout(Curtain.Net.Sockets.PLC.Core.ReceiveSession)">
+            <summary>
+            客户端发送超时
+            </summary>
+            <param name="rs"></param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.OnReceiveTimeout(Curtain.Net.Sockets.PLC.Core.ReceiveSession,System.Boolean)">
+            <summary>
+            服务接收超时
+            </summary>
+            <param name="rs"></param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.Start(System.Int32)">
+            <summary>
+            启动服务
+            </summary>
+            <param name="port">端口号</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.Start(System.Int32,System.Int32)">
+            <summary>
+            启动服务
+            </summary>
+            <param name="port">端口号</param>
+            <param name="backlog">挂起连接队列的最大长度</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.Start(System.Int32,System.Net.IPAddress,System.Int32)">
+            <summary>
+            启动服务
+            </summary>
+            <param name="port">端口号</param>
+            <param name="ipAddress">IP地址</param>
+            <param name="backlog">挂起连接队列的最大长度</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.Stop">
+            <summary>
+            关闭服务器的引擎
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket.Dispose">
+            <summary>
+            销毁
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.ServerSocket`1">
+            <summary>
+            Socket 服务端
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ServerSocket`1.Model">
+            <summary>
+            服务端模型
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ServerSocket`1.ServerModel">
+            <summary>
+            服务端模型
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket`1.#ctor(System.Boolean)">
+            <summary>
+            Socket 服务端
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ServerSocket`1.#ctor(`0)">
+            <summary>
+            Socket 服务端
+            </summary>
+            <param name="newModel">新实例</param>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.ThreadLock.IThreadLock">
+            <summary>
+            线程同步操作锁
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ThreadLock.IThreadLock.Locked">
+            <summary>
+            锁定状态
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ThreadLock.IThreadLock.Lock(System.Int32)">
+            <summary>
+            锁定
+            </summary>
+            <param name="timeout"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ThreadLock.IThreadLock.Unlock">
+            <summary>
+            解锁
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.ThreadLock.ReaderWriterThreadLock">
+            <summary>
+            线程同步操作读写锁
+            </summary>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.PLCSocket">
+            <summary>
+            Socket 通信基类
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.PLCSocket.Socket">
+            <summary>
+            通信用Socket
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.PLCSocket.ThreadLock">
+            <summary>
+            线程锁
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.#ctor">
+            <summary>
+            Socket 通信基类
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.#ctor(System.Net.Sockets.Socket)">
+            <summary>
+            Socket 通信基类
+            </summary>
+            <param name="socket">Socket</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.CreateSocket(System.Net.Sockets.AddressFamily,System.Net.Sockets.SocketType,System.Net.Sockets.ProtocolType)">
+            <summary>
+            创建Socket
+            </summary>
+            <param name="addressFamily"></param>
+            <param name="socketType"></param>
+            <param name="protocolType"></param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.CreateSocket">
+            <summary>
+            创建Socket
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.Connect(System.String,System.Int32)">
+            <summary>
+            连接Socket
+            </summary>
+            <param name="host"></param>
+            <param name="port"></param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.Disconnect">
+            <summary>
+            断开连接
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.Close">
+            <summary>
+            关闭Socket
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.Dispose">
+            <summary>
+            销毁
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.Send(System.Byte[])">
+            <summary>
+            发送
+            </summary>
+            <param name="data"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.BeginSend(System.Byte[])">
+            <summary>
+            异步发送
+            </summary>
+            <param name="data"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.SendCallBack(System.IAsyncResult)">
+            <summary>
+            发送结束
+            </summary>
+            <param name="iar"></param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.Receive(System.Int32)">
+            <summary>
+            接收
+            </summary>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.BeginReceive(System.Int32)">
+            <summary>
+            异步接收
+            </summary>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.PLCSocket.ReceiveCallback(System.IAsyncResult)">
+            <summary>
+            接收结束
+            </summary>
+            <param name="iar"></param>
+        </member>
+        <member name="T:Curtain.Net.Sockets.PLC.ClientSocket`1">
+            <summary>
+            Socket 客户端
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ClientSocket`1.ReceiveTimeout">
+            <summary>
+            通信超时(毫秒)
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ClientSocket`1.Host">
+            <summary>
+            主机地址
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ClientSocket`1.Port">
+            <summary>
+            主机端口
+            </summary>
+        </member>
+        <member name="P:Curtain.Net.Sockets.PLC.ClientSocket`1.PLCModel">
+            <summary>
+            PLC通信模型
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.#ctor(System.Boolean)">
+            <summary>
+            Socket 客户端
+            </summary>
+            <param name="newModel">新实例</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.#ctor(`0)">
+            <summary>
+            Socket 客户端
+            </summary>
+            <param name="newModel">新实例</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.#ctor(System.String,System.Int32,System.Boolean)">
+            <summary>
+            Socket 客户端
+            </summary>
+            <param name="host">主机地址</param>
+            <param name="port">主机端口</param>
+            <param name="newModel">新实例</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.#ctor(System.String,System.Int32,`0)">
+            <summary>
+            Socket 客户端
+            </summary>
+            <param name="host">主机地址</param>
+            <param name="port">主机端口</param>
+            <param name="newModel">新实例</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.Connect">
+            <summary>
+            连接PLC
+            </summary>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.Connect(System.String,System.Int32)">
+            <summary>
+            连接PLC
+            </summary>
+            <param name="host">主机地址</param>
+            <param name="port">主机端口</param>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.SendByClient(System.Byte[])">
+            <summary>
+            发送命令报文
+            </summary>
+            <param name="data"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.ReceiveByClient(System.Int32)">
+            <summary>
+            接收响应报文
+            </summary>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.DoCommandOneWay(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            执行命令(不等待响应)
+            </summary>
+            <param name="m">报文</param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.DoCommand(Curtain.Net.Sockets.PLC.Core.PLCMessage)">
+            <summary>
+            执行命令
+            </summary>
+            <param name="m">报文</param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.Read(System.Char,System.Int32,System.Int32)">
+            <summary>
+            读取
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.Write(System.Char,System.Int32,System.Int32)">
+            <summary>
+            写入
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="value"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Curtain.Net.Sockets.PLC.ClientSocket`1.Write(System.Char,System.Int32,System.String,System.Int32)">
+            <summary>
+            写入
+            </summary>
+            <param name="code"></param>
+            <param name="number"></param>
+            <param name="value"></param>
+            <param name="length"></param>
+            <returns></returns>
+        </member>
+    </members>
+</doc>

二進制
DLL/zxing.dll


文件差異過大導致無法顯示
+ 502 - 497
DLL/zxing.xml


+ 19 - 0
IBOSS.PRD.sln

@@ -128,6 +128,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PPModuleService", "DK.Servi
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PPModule", "DK.Client\PPModule\PPModule.csproj", "{3ADEFD6C-64B4-41B3-A157-84A99CCA9A5C}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InvoiceLayout", "DK.Service\InvoiceLayout\InvoiceLayout.csproj", "{440B03E6-474C-439A-AF83-900A01A57ABE}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -957,6 +959,22 @@ Global
 		{3ADEFD6C-64B4-41B3-A157-84A99CCA9A5C}.Release|x64.Build.0 = Release|Any CPU
 		{3ADEFD6C-64B4-41B3-A157-84A99CCA9A5C}.Release|x86.ActiveCfg = Release|x86
 		{3ADEFD6C-64B4-41B3-A157-84A99CCA9A5C}.Release|x86.Build.0 = Release|x86
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Debug|x64.Build.0 = Debug|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Debug|x86.ActiveCfg = Debug|x86
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Debug|x86.Build.0 = Debug|x86
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Release|x64.ActiveCfg = Release|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Release|x64.Build.0 = Release|Any CPU
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Release|x86.ActiveCfg = Release|x86
+		{440B03E6-474C-439A-AF83-900A01A57ABE}.Release|x86.Build.0 = Release|x86
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -1012,6 +1030,7 @@ Global
 		{41D66009-A06F-4632-869C-110AB1C3B969} = {4F444F96-11BB-4747-85BB-1AA1C90BD882}
 		{812E21A4-4925-4129-AF25-FD15B1BDA1AA} = {4F444F96-11BB-4747-85BB-1AA1C90BD882}
 		{3ADEFD6C-64B4-41B3-A157-84A99CCA9A5C} = {E9343424-91E2-493F-B0F0-3761452B9899}
+		{440B03E6-474C-439A-AF83-900A01A57ABE} = {4F444F96-11BB-4747-85BB-1AA1C90BD882}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {76578E1C-DBEC-4554-A011-D4113926C5B3}

+ 7 - 0
IBOSS.PRD/IBOSS.PRD.csproj

@@ -103,6 +103,10 @@
     <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="Curtain.Framework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\DLL\Curtain.Framework.dll</HintPath>
+    </Reference>
     <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\DK.Service\PDAModuleLogic\DLL\Newtonsoft.Json.dll</HintPath>
@@ -115,6 +119,9 @@
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
     <Reference Include="System.Xml.Linq" />
+    <Reference Include="zxing">
+      <HintPath>..\DLL\zxing.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="F_SYS_0101.cs">

+ 1 - 0
WCF.Service/WCF.Services/PDAModuleService.cs

@@ -34,6 +34,7 @@ using Dongke.IBOSS.PRD.WCF.DataModels.ConfigModule;
 using Dongke.IBOSS.PRD.WCF.DataModels.HRModule;
 using Dongke.IBOSS.PRD.WCF.DataModels.PCModule;
 using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
+using Dongke.WinForm.Controls.InvoiceLayout;
 
 namespace Dongke.IBOSS.PRD.WCF.Services
 {

+ 1 - 0
WCF.Service/WCF.Services/PDAModuleServiceGet.cs

@@ -37,6 +37,7 @@ using Dongke.IBOSS.PRD.WCF.DataModels.ConfigModule;
 using Dongke.IBOSS.PRD.WCF.DataModels.HRModule;
 using Dongke.IBOSS.PRD.WCF.DataModels.PCModule;
 using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
+using Dongke.WinForm.Controls.InvoiceLayout;
 
 namespace Dongke.IBOSS.PRD.WCF.Services
 {

+ 1 - 1
WCF.Service/WCF.Services/SmartDeviceService.cs

@@ -21,7 +21,7 @@ using Dongke.IBOSS.PRD.Service.PMModuleLogic;
 using Dongke.IBOSS.PRD.Service.SmartDeviceService;
 using Dongke.IBOSS.PRD.WCF.Contracts;
 using Dongke.IBOSS.PRD.WCF.DataModels;
-
+using Dongke.WinForm.Controls.InvoiceLayout;
 using Newtonsoft.Json.Linq;
 
 namespace Dongke.IBOSS.PRD.WCF.Services

部分文件因文件數量過多而無法顯示