using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using JXC_MIS.MyClass;
using JXC_MIS.DataTier;
namespace JXC_MIS.UserTier.ToolForm
{
	/// <summary>
	/// frmDetailSetup 的摘要说明。
	/// </summary>
	public class frmDetailSetup : System.Windows.Forms.Form
	{
		ClsCellAttrib newCellAttrib=new ClsCellAttrib();
		private string m_FormatString  ;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label lbl_Caption1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Button cmd_Cancel;
		private System.Windows.Forms.Button cmd_OK;
		private System.Windows.Forms.ComboBox cbo_TextAlign;
		private System.Windows.Forms.ComboBox cbo_ReadOnly;
		private System.Windows.Forms.TextBox txt_Caption;
		private System.Windows.Forms.ComboBox cbo_Referto;
		private System.Windows.Forms.ComboBox cbo_Save;
		private System.Windows.Forms.ComboBox cbo_Check;
		private System.Windows.Forms.TextBox txt_RefertoDataSource;
		private System.Windows.Forms.TextBox txt_CodeToName;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.Label label12;
		private System.Windows.Forms.TextBox txt_Express;
		private System.Windows.Forms.Button cmd_Add;
		private System.Windows.Forms.Button cmd_Clear;
		private System.Windows.Forms.Button cmd_Edit;
		private ljs.MyFlexGrid grd_Edit;
		private System.Windows.Forms.ListView lv_List;
		private System.Windows.Forms.ColumnHeader columnHeader1;
		private System.Windows.Forms.ColumnHeader columnHeader2;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.ComboBox cbo_ShowFormat;
		private System.Windows.Forms.ComboBox cbo_ColSum;
		private System.Windows.Forms.Label label13;
		private System.Windows.Forms.ComboBox cbo_Default;
		private System.Windows.Forms.Button cmd_SQL;
		private System.Windows.Forms.ComboBox cbo_ReturnCols;
		private System.Windows.Forms.Label label14;
		private System.Windows.Forms.Label label15;
		private System.Windows.Forms.ComboBox cbo_InputCols;
		private System.Windows.Forms.Button cmd_ProcedureSetup;
		private System.Windows.Forms.ComboBox cbo_NoDataBind;
//		m_TextAlign=null  ;	               //对齐方式
//		m_TextDefault=null   ;	                //默认值;
//		m_ReadOnly =false ;	                    //是否编辑
//		m_RefertoType=null   ;			       //参照类型
//		m_RefertoDataSource=null   ;	        //参照数据源
//		m_NotSave=false  ;				        //不否保存
//		m_CodeToName=null   ;				   //代码转换{表名，代码字段，名称字段}
//		m_CheckType=null   ;					//数据保存时数据验证类型（0或空=可以为空，1=不为空，2=日期验证，3=数值验证)
//		m_ColSum=null   ;						 //计算列求和
//		m_ColExpress=null   ;				    //计算表达式
//		m_FoldCol=null   ;				    //计算表达式折行标识
//		m_Caption=null   ;		
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		/// <summary>
		/// 格式化的字符串
		/// </summary>
		public string FormatString
		{ 
			get {return m_FormatString;} 

			set
			{ 
				m_FormatString=value;

			} 
		} 
		public frmDetailSetup()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.lbl_Caption1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.cbo_TextAlign = new System.Windows.Forms.ComboBox();
			this.cbo_ReadOnly = new System.Windows.Forms.ComboBox();
			this.cbo_Referto = new System.Windows.Forms.ComboBox();
			this.cbo_Save = new System.Windows.Forms.ComboBox();
			this.cbo_Check = new System.Windows.Forms.ComboBox();
			this.txt_RefertoDataSource = new System.Windows.Forms.TextBox();
			this.txt_CodeToName = new System.Windows.Forms.TextBox();
			this.txt_Express = new System.Windows.Forms.TextBox();
			this.cmd_Cancel = new System.Windows.Forms.Button();
			this.cmd_OK = new System.Windows.Forms.Button();
			this.txt_Caption = new System.Windows.Forms.TextBox();
			this.label10 = new System.Windows.Forms.Label();
			this.textBox2 = new System.Windows.Forms.TextBox();
			this.label11 = new System.Windows.Forms.Label();
			this.label12 = new System.Windows.Forms.Label();
			this.cmd_Add = new System.Windows.Forms.Button();
			this.cmd_Clear = new System.Windows.Forms.Button();
			this.cmd_Edit = new System.Windows.Forms.Button();
			this.grd_Edit = new ljs.MyFlexGrid();
			this.lv_List = new System.Windows.Forms.ListView();
			this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.cbo_NoDataBind = new System.Windows.Forms.ComboBox();
			this.cmd_ProcedureSetup = new System.Windows.Forms.Button();
			this.cbo_InputCols = new System.Windows.Forms.ComboBox();
			this.cbo_ReturnCols = new System.Windows.Forms.ComboBox();
			this.label15 = new System.Windows.Forms.Label();
			this.label14 = new System.Windows.Forms.Label();
			this.cmd_SQL = new System.Windows.Forms.Button();
			this.cbo_Default = new System.Windows.Forms.ComboBox();
			this.label13 = new System.Windows.Forms.Label();
			this.cbo_ColSum = new System.Windows.Forms.ComboBox();
			this.cbo_ShowFormat = new System.Windows.Forms.ComboBox();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(2, 444);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(746, 44);
			this.label1.TabIndex = 2;
			this.label1.Text = "注：[对齐方式; 默认值;是否编辑;参照类型(网格列表参照=0,日期参照=1,ListBox列表参照=2,树型列表参照=3,树型文件路径参照=4);参照数据源;是" +
				"否保存;是否代码转换{表名，代码字段，名称字段};数据保存时数据验证（0或空=可以为空，1=不为空，2=日期验证，3=数值验证)；计算列；该列是否列合计（sum" +
				"）]";
			// 
			// lbl_Caption1
			// 
			this.lbl_Caption1.Location = new System.Drawing.Point(8, 22);
			this.lbl_Caption1.Name = "lbl_Caption1";
			this.lbl_Caption1.Size = new System.Drawing.Size(274, 14);
			this.lbl_Caption1.TabIndex = 3;
			this.lbl_Caption1.Text = "1.对齐方式：";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 70);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(290, 14);
			this.label2.TabIndex = 4;
			this.label2.Text = "3.默认值(或主键)：                         ";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(8, 92);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(106, 14);
			this.label3.TabIndex = 5;
			this.label3.Text = "4.不可编辑：";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(8, 114);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(84, 14);
			this.label4.TabIndex = 6;
			this.label4.Text = "5.参照类型：";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(10, 182);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(104, 14);
			this.label5.TabIndex = 7;
			this.label5.Text = "6.参照数据源：";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(8, 246);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(104, 14);
			this.label6.TabIndex = 8;
			this.label6.Text = "7.不保存：";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(8, 264);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(104, 14);
			this.label7.TabIndex = 9;
			this.label7.Text = "8.代码转换：";
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(8, 290);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(104, 14);
			this.label8.TabIndex = 10;
			this.label8.Text = "9.完整性验证：";
			// 
			// label9
			// 
			this.label9.Location = new System.Drawing.Point(8, 316);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(104, 14);
			this.label9.TabIndex = 11;
			this.label9.Text = "10.计算表达式：";
			// 
			// cbo_TextAlign
			// 
			this.cbo_TextAlign.Items.AddRange(new object[] {
															   "<   =居左对齐",
															   "^   =居中对齐",
															   ">   =居右对齐",
															   "$   =换行",
															   "<$ =居左对齐并换行",
															   "^$ =居中对齐并换行",
															   ">$ =居右对齐并换行"});
			this.cbo_TextAlign.Location = new System.Drawing.Point(122, 18);
			this.cbo_TextAlign.Name = "cbo_TextAlign";
			this.cbo_TextAlign.Size = new System.Drawing.Size(244, 20);
			this.cbo_TextAlign.TabIndex = 12;
			this.cbo_TextAlign.Text = "<  =居左对齐";
			// 
			// cbo_ReadOnly
			// 
			this.cbo_ReadOnly.Items.AddRange(new object[] {
															  "True",
															  "False"});
			this.cbo_ReadOnly.Location = new System.Drawing.Point(120, 88);
			this.cbo_ReadOnly.Name = "cbo_ReadOnly";
			this.cbo_ReadOnly.Size = new System.Drawing.Size(248, 20);
			this.cbo_ReadOnly.TabIndex = 14;
			this.cbo_ReadOnly.Text = "True";
			// 
			// cbo_Referto
			// 
			this.cbo_Referto.Items.AddRange(new object[] {
															 "0=网格列表参照",
															 "1=日期参照",
															 "2=列表参照",
															 "3=数型结构参照",
															 "4=数型文件路径参照",
															 "5=文本输入参照",
															 "6=复选参照",
															 "11=其它"});
			this.cbo_Referto.Location = new System.Drawing.Point(119, 112);
			this.cbo_Referto.Name = "cbo_Referto";
			this.cbo_Referto.Size = new System.Drawing.Size(249, 20);
			this.cbo_Referto.TabIndex = 15;
			this.cbo_Referto.SelectedIndexChanged += new System.EventHandler(this.cbo_Referto_SelectedIndexChanged);
			// 
			// cbo_Save
			// 
			this.cbo_Save.Items.AddRange(new object[] {
														  "True",
														  "False"});
			this.cbo_Save.Location = new System.Drawing.Point(120, 242);
			this.cbo_Save.Name = "cbo_Save";
			this.cbo_Save.Size = new System.Drawing.Size(246, 20);
			this.cbo_Save.TabIndex = 16;
			// 
			// cbo_Check
			// 
			this.cbo_Check.Items.AddRange(new object[] {
														   "0=可以为空(或空)",
														   "1=不为空",
														   "12=日期验证并且不为空",
														   "13=数值验证并且不为空",
														   "02=日期验证且可以为空",
														   "03=数值验证且可以为空",
														   "04=存在验证"});
			this.cbo_Check.Location = new System.Drawing.Point(120, 288);
			this.cbo_Check.Name = "cbo_Check";
			this.cbo_Check.Size = new System.Drawing.Size(246, 20);
			this.cbo_Check.TabIndex = 17;
			// 
			// txt_RefertoDataSource
			// 
			this.txt_RefertoDataSource.Location = new System.Drawing.Point(120, 180);
			this.txt_RefertoDataSource.Multiline = true;
			this.txt_RefertoDataSource.Name = "txt_RefertoDataSource";
			this.txt_RefertoDataSource.Size = new System.Drawing.Size(246, 60);
			this.txt_RefertoDataSource.TabIndex = 18;
			this.txt_RefertoDataSource.Text = "";
			// 
			// txt_CodeToName
			// 
			this.txt_CodeToName.Location = new System.Drawing.Point(120, 264);
			this.txt_CodeToName.Name = "txt_CodeToName";
			this.txt_CodeToName.Size = new System.Drawing.Size(246, 21);
			this.txt_CodeToName.TabIndex = 19;
			this.txt_CodeToName.Text = "";
			// 
			// txt_Express
			// 
			this.txt_Express.Location = new System.Drawing.Point(120, 312);
			this.txt_Express.Multiline = true;
			this.txt_Express.Name = "txt_Express";
			this.txt_Express.Size = new System.Drawing.Size(246, 22);
			this.txt_Express.TabIndex = 20;
			this.txt_Express.Text = "";
			// 
			// cmd_Cancel
			// 
			this.cmd_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cmd_Cancel.Location = new System.Drawing.Point(670, 416);
			this.cmd_Cancel.Name = "cmd_Cancel";
			this.cmd_Cancel.Size = new System.Drawing.Size(74, 24);
			this.cmd_Cancel.TabIndex = 22;
			this.cmd_Cancel.Text = "取消(&C)";
			// 
			// cmd_OK
			// 
			this.cmd_OK.Location = new System.Drawing.Point(596, 416);
			this.cmd_OK.Name = "cmd_OK";
			this.cmd_OK.Size = new System.Drawing.Size(74, 24);
			this.cmd_OK.TabIndex = 21;
			this.cmd_OK.Text = "确定(&O)";
			this.cmd_OK.Click += new System.EventHandler(this.cmd_OK_Click);
			// 
			// txt_Caption
			// 
			this.txt_Caption.Location = new System.Drawing.Point(122, 40);
			this.txt_Caption.Name = "txt_Caption";
			this.txt_Caption.Size = new System.Drawing.Size(244, 21);
			this.txt_Caption.TabIndex = 23;
			this.txt_Caption.Text = "";
			// 
			// label10
			// 
			this.label10.Location = new System.Drawing.Point(8, 338);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(104, 14);
			this.label10.TabIndex = 24;
			this.label10.Text = "11.列求和：";
			// 
			// textBox2
			// 
			this.textBox2.Location = new System.Drawing.Point(120, 360);
			this.textBox2.Multiline = true;
			this.textBox2.Name = "textBox2";
			this.textBox2.Size = new System.Drawing.Size(246, 12);
			this.textBox2.TabIndex = 27;
			this.textBox2.Text = "";
			// 
			// label11
			// 
			this.label11.Location = new System.Drawing.Point(8, 364);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(104, 14);
			this.label11.TabIndex = 26;
			this.label11.Text = "12.显示格式：";
			// 
			// label12
			// 
			this.label12.Location = new System.Drawing.Point(8, 386);
			this.label12.Name = "label12";
			this.label12.Size = new System.Drawing.Size(104, 14);
			this.label12.TabIndex = 28;
			this.label12.Text = "13.不绑定数据：";
			// 
			// cmd_Add
			// 
			this.cmd_Add.Location = new System.Drawing.Point(504, 416);
			this.cmd_Add.Name = "cmd_Add";
			this.cmd_Add.Size = new System.Drawing.Size(68, 24);
			this.cmd_Add.TabIndex = 30;
			this.cmd_Add.Text = "插入";
			this.cmd_Add.Click += new System.EventHandler(this.cmd_Add_Click);
			// 
			// cmd_Clear
			// 
			this.cmd_Clear.Location = new System.Drawing.Point(370, 416);
			this.cmd_Clear.Name = "cmd_Clear";
			this.cmd_Clear.Size = new System.Drawing.Size(66, 24);
			this.cmd_Clear.TabIndex = 31;
			this.cmd_Clear.Text = "清除";
			this.cmd_Clear.Click += new System.EventHandler(this.cmd_Clear_Click);
			// 
			// cmd_Edit
			// 
			this.cmd_Edit.Location = new System.Drawing.Point(438, 416);
			this.cmd_Edit.Name = "cmd_Edit";
			this.cmd_Edit.Size = new System.Drawing.Size(62, 24);
			this.cmd_Edit.TabIndex = 32;
			this.cmd_Edit.Text = "修改";
			this.cmd_Edit.Click += new System.EventHandler(this.cmd_Edit_Click);
			// 
			// grd_Edit
			// 
			this.grd_Edit.BackColorSel = System.Drawing.SystemColors.Highlight;
			this.grd_Edit.BorderStyle = true;
			this.grd_Edit.CellBackColor = System.Drawing.Color.Silver;
			this.grd_Edit.CellColLength = 0;
			this.grd_Edit.CellForeColor = System.Drawing.SystemColors.ControlText;
			this.grd_Edit.CellMultiLine = false;
			this.grd_Edit.CellRowLength = 0;
			this.grd_Edit.CellTag = null;
			this.grd_Edit.Col = 0;
			this.grd_Edit.ColCommanFormat = null;
			this.grd_Edit.ColLocked = false;
			this.grd_Edit.Cols = 3;
			this.grd_Edit.ColSel = 2;
			this.grd_Edit.DetailFormat = null;
			this.grd_Edit.EnterToTab = true;
			this.grd_Edit.FixedBackColor = System.Drawing.Color.Silver;
			this.grd_Edit.FixedCols = 2;
			this.grd_Edit.FormatString = null;
			this.grd_Edit.FormatString1 = null;
			this.grd_Edit.GridColor = System.Drawing.Color.FromArgb(((System.Byte)(183)), ((System.Byte)(183)), ((System.Byte)(183)));
			this.grd_Edit.GridStyle = true;
			this.grd_Edit.Location = new System.Drawing.Point(4, 6);
			this.grd_Edit.MultiHead = false;
			this.grd_Edit.Name = "grd_Edit";
			this.grd_Edit.OnlyRead = false;
			this.grd_Edit.Row = 0;
			this.grd_Edit.Rows = 2;
			this.grd_Edit.RowSel = 0;
			this.grd_Edit.SetCellWidth = null;
			this.grd_Edit.Size = new System.Drawing.Size(360, 434);
			this.grd_Edit.TabIndex = 33;
			this.grd_Edit.Row_Click += new ljs.FlexGridRow_Click(this.grd_Edit_Row_Click);
			// 
			// lv_List
			// 
			this.lv_List.AllowColumnReorder = true;
			this.lv_List.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lv_List.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																					  this.columnHeader1,
																					  this.columnHeader2});
			this.lv_List.GridLines = true;
			this.lv_List.HideSelection = false;
			this.lv_List.HoverSelection = true;
			this.lv_List.LabelEdit = true;
			this.lv_List.Location = new System.Drawing.Point(2, 304);
			this.lv_List.Name = "lv_List";
			this.lv_List.Size = new System.Drawing.Size(360, 74);
			this.lv_List.TabIndex = 34;
			this.lv_List.View = System.Windows.Forms.View.Details;
			this.lv_List.Visible = false;
			// 
			// columnHeader1
			// 
			this.columnHeader1.Text = "标题";
			this.columnHeader1.Width = 150;
			// 
			// columnHeader2
			// 
			this.columnHeader2.Text = "内容格式";
			this.columnHeader2.Width = 300;
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.cbo_NoDataBind);
			this.groupBox1.Controls.Add(this.cmd_ProcedureSetup);
			this.groupBox1.Controls.Add(this.cbo_InputCols);
			this.groupBox1.Controls.Add(this.cbo_ReturnCols);
			this.groupBox1.Controls.Add(this.label15);
			this.groupBox1.Controls.Add(this.label14);
			this.groupBox1.Controls.Add(this.cmd_SQL);
			this.groupBox1.Controls.Add(this.cbo_Default);
			this.groupBox1.Controls.Add(this.label13);
			this.groupBox1.Controls.Add(this.cbo_ColSum);
			this.groupBox1.Controls.Add(this.cbo_ShowFormat);
			this.groupBox1.Controls.Add(this.txt_Caption);
			this.groupBox1.Controls.Add(this.txt_Express);
			this.groupBox1.Controls.Add(this.txt_CodeToName);
			this.groupBox1.Controls.Add(this.txt_RefertoDataSource);
			this.groupBox1.Controls.Add(this.cbo_Check);
			this.groupBox1.Controls.Add(this.cbo_Save);
			this.groupBox1.Controls.Add(this.cbo_Referto);
			this.groupBox1.Controls.Add(this.cbo_ReadOnly);
			this.groupBox1.Controls.Add(this.cbo_TextAlign);
			this.groupBox1.Controls.Add(this.label9);
			this.groupBox1.Controls.Add(this.label8);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.lbl_Caption1);
			this.groupBox1.Controls.Add(this.label12);
			this.groupBox1.Controls.Add(this.label11);
			this.groupBox1.Controls.Add(this.textBox2);
			this.groupBox1.Controls.Add(this.label10);
			this.groupBox1.Location = new System.Drawing.Point(368, 2);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(378, 410);
			this.groupBox1.TabIndex = 35;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "[属性]";
			this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
			// 
			// cbo_NoDataBind
			// 
			this.cbo_NoDataBind.Items.AddRange(new object[] {
																"True",
																"False"});
			this.cbo_NoDataBind.Location = new System.Drawing.Point(120, 382);
			this.cbo_NoDataBind.Name = "cbo_NoDataBind";
			this.cbo_NoDataBind.Size = new System.Drawing.Size(246, 20);
			this.cbo_NoDataBind.TabIndex = 40;
			// 
			// cmd_ProcedureSetup
			// 
			this.cmd_ProcedureSetup.Location = new System.Drawing.Point(22, 220);
			this.cmd_ProcedureSetup.Name = "cmd_ProcedureSetup";
			this.cmd_ProcedureSetup.Size = new System.Drawing.Size(88, 23);
			this.cmd_ProcedureSetup.TabIndex = 39;
			this.cmd_ProcedureSetup.Text = "存储过程设置";
			this.cmd_ProcedureSetup.Click += new System.EventHandler(this.cmd_ProcedureSetup_Click);
			// 
			// cbo_InputCols
			// 
			this.cbo_InputCols.Items.AddRange(new object[] {
															   "1:2:3:4:5:6:7:8",
															   ": : : : : : : : : : : :"});
			this.cbo_InputCols.Location = new System.Drawing.Point(120, 156);
			this.cbo_InputCols.Name = "cbo_InputCols";
			this.cbo_InputCols.Size = new System.Drawing.Size(246, 20);
			this.cbo_InputCols.TabIndex = 36;
			// 
			// cbo_ReturnCols
			// 
			this.cbo_ReturnCols.Items.AddRange(new object[] {
																"1:2:3:4:5:6:7:8"});
			this.cbo_ReturnCols.Location = new System.Drawing.Point(120, 134);
			this.cbo_ReturnCols.Name = "cbo_ReturnCols";
			this.cbo_ReturnCols.Size = new System.Drawing.Size(246, 20);
			this.cbo_ReturnCols.TabIndex = 35;
			// 
			// label15
			// 
			this.label15.Location = new System.Drawing.Point(22, 162);
			this.label15.Name = "label15";
			this.label15.Size = new System.Drawing.Size(102, 16);
			this.label15.TabIndex = 38;
			this.label15.Text = "B.目标对应列：";
			// 
			// label14
			// 
			this.label14.Location = new System.Drawing.Point(22, 138);
			this.label14.Name = "label14";
			this.label14.Size = new System.Drawing.Size(104, 14);
			this.label14.TabIndex = 37;
			this.label14.Text = "A.参照返回列：";
			// 
			// cmd_SQL
			// 
			this.cmd_SQL.Location = new System.Drawing.Point(22, 198);
			this.cmd_SQL.Name = "cmd_SQL";
			this.cmd_SQL.Size = new System.Drawing.Size(88, 22);
			this.cmd_SQL.TabIndex = 34;
			this.cmd_SQL.Text = "SQL生成器...";
			this.cmd_SQL.Click += new System.EventHandler(this.cmd_SQL_Click);
			// 
			// cbo_Default
			// 
			this.cbo_Default.Items.AddRange(new object[] {
															 "@Type=单据类型(例如 销售收款、销售预收款)",
															 "@Operator=操作员",
															 "@SysDate=系统日期",
															 "@GUID=唯一标识符",
															 "@ReceiptNo=单据编号(普通年月日编号)",
															 "@GuidReceptNo=单据编号(唯一标识符)",
															 "@KeyID=主键(唯一标识)"});
			this.cbo_Default.Location = new System.Drawing.Point(122, 64);
			this.cbo_Default.Name = "cbo_Default";
			this.cbo_Default.Size = new System.Drawing.Size(244, 20);
			this.cbo_Default.TabIndex = 33;
			// 
			// label13
			// 
			this.label13.Location = new System.Drawing.Point(8, 46);
			this.label13.Name = "label13";
			this.label13.Size = new System.Drawing.Size(96, 16);
			this.label13.TabIndex = 32;
			this.label13.Text = "2.标题：";
			// 
			// cbo_ColSum
			// 
			this.cbo_ColSum.Items.AddRange(new object[] {
															"True",
															"False"});
			this.cbo_ColSum.Location = new System.Drawing.Point(120, 338);
			this.cbo_ColSum.Name = "cbo_ColSum";
			this.cbo_ColSum.Size = new System.Drawing.Size(246, 20);
			this.cbo_ColSum.TabIndex = 31;
			// 
			// cbo_ShowFormat
			// 
			this.cbo_ShowFormat.Items.AddRange(new object[] {
																"#######0.0",
																"#######0.00",
																"#######0.000",
																"#######0.0000",
																"#######0.00000",
																"#######0.000000",
																"##,###,##0.0",
																"##,###,##0.00",
																"##,###,##0.000",
																"##,###,##0.0000",
																"##,###,##0.00000",
																"##,###,##0.000000",
																"YYYY-MM-DD",
																"YYYY/MM/DD"});
			this.cbo_ShowFormat.Location = new System.Drawing.Point(120, 360);
			this.cbo_ShowFormat.Name = "cbo_ShowFormat";
			this.cbo_ShowFormat.Size = new System.Drawing.Size(246, 20);
			this.cbo_ShowFormat.TabIndex = 30;
			// 
			// frmDetailSetup
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(748, 501);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.lv_List);
			this.Controls.Add(this.grd_Edit);
			this.Controls.Add(this.cmd_Edit);
			this.Controls.Add(this.cmd_Clear);
			this.Controls.Add(this.cmd_Add);
			this.Controls.Add(this.cmd_Cancel);
			this.Controls.Add(this.cmd_OK);
			this.Controls.Add(this.label1);
			this.Name = "frmDetailSetup";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "frmDetailSetup";
			this.Load += new System.EventHandler(this.frmDetailSetup_Load);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void frmDetailSetup_Load(object sender, System.EventArgs e)
		{
			grd_Edit.Cols=3;

			if (m_FormatString!=null)
			{
				GetText(m_FormatString);
			}
			else
			{
				grd_Edit.Rows=2;

			}

//			grd_Edit.FixedCols=3;
			grd_Edit.FormatString ="No|项目|内容样式";
			grd_Edit.FormatString1 ="No|项目|内容样式";
			grd_Edit.DetailFormat  ="No|项目|内容样式";
			grd_Edit.SetCellWidth="300,1500,4000"; 
			grd_Edit.ScrollBars="Both";
//			this.grd_Edit.FixedBackColor = System.Drawing.Color.White;

		}
		private void GetText(string p_FormatString)
		{
			string[] sArray=null;
			sArray=p_FormatString.Split('|');
			int j=sArray.Length ;
			int r=0;
			grd_Edit.Rows=j+1;
			for (int i=0;i<j;i++)
			{   
				r=i+1;
				newCellAttrib.FormatString =sArray[i];
				grd_Edit.SetCellText(r,0,i.ToString());
				grd_Edit.SetCellText(r,1,newCellAttrib.Caption);
				grd_Edit.SetCellText(r,2,sArray[i]);
//				grd_Edit.RowInsert("",grd_Edit.Rows);
			
			}
		}
		private void GetGridText(string p_FormatString)
		{
			newCellAttrib.FormatString =p_FormatString;
			this.cbo_TextAlign.Text=newCellAttrib.TextAlign+newCellAttrib.AlignFoldCol.ToString() ;
			this.txt_Caption.Text=newCellAttrib.Caption ;
			this.cbo_Default.Text =newCellAttrib.TextDefault;
			if (newCellAttrib.ReadOnly==false)
			{
				this.cbo_ReadOnly.Text="";
			}
			else
			{
				this.cbo_ReadOnly.Text=newCellAttrib.ReadOnly.ToString();
			}

			this.cbo_Referto.Text=newCellAttrib.RefertoType ;
			this.cbo_ReturnCols.Text=newCellAttrib.RefertoReturnCols  ;
			this.cbo_InputCols.Text=newCellAttrib.RefertoInputCols;

			this.txt_RefertoDataSource.Text=newCellAttrib.RefertoDataSource;
			if (newCellAttrib.NotSave==false)
			{
			this.cbo_Save.Text="";
			}
			else
			{
			this.cbo_Save.Text=newCellAttrib.NotSave.ToString();
			}

			this.txt_CodeToName.Text=newCellAttrib.CodeToName ;
			this.cbo_Check.Text=newCellAttrib.CheckType ;
			txt_Express.Text=newCellAttrib.ColExpress ;
			if (newCellAttrib.ColSum==false)
			{
				this.cbo_ColSum.Text="";
			}
			else
			{
				this.cbo_ColSum.Text=newCellAttrib.ColSum.ToString();
			}
			cbo_ShowFormat.Text =newCellAttrib.ShowFormat ;
			if (newCellAttrib.NoDataBind ==false)
			{
				this.cbo_NoDataBind.Text="";
			}
			else
			{
				this.cbo_NoDataBind.Text=newCellAttrib.NoDataBind.ToString();
			}
		}
		private void cmd_Add_Click(object sender, System.EventArgs e)
		{
			grd_Edit.RowInsert("",grd_Edit.Row);
			grd_Edit.SetCellText(grd_Edit.Row,0,grd_Edit.Row.ToString());
			grd_Edit.SetCellText(grd_Edit.Row,1,this.txt_Caption.Text);
			grd_Edit.SetCellText(grd_Edit.Row,2,GetTextString());
		}
		private string GetTextString()
		{
			string [] sArrTemp=null;
			sArrTemp=this.cbo_TextAlign.Text.Split('=');

			newCellAttrib.TextAlign =sArrTemp[0].Trim();

			newCellAttrib.Caption=this.txt_Caption.Text;

			sArrTemp=this.cbo_Default.Text.Split('=');
			newCellAttrib.TextDefault =sArrTemp[0].Trim();

			if (this.cbo_ReadOnly.Text.ToLower()=="true")
			{
				newCellAttrib.ReadOnly =true;
			}
			else
			{
				newCellAttrib.ReadOnly =false;
			}
			sArrTemp=this.cbo_Referto.Text.Split('=');
			newCellAttrib.RefertoType =sArrTemp[0];

			if (this.cbo_ReturnCols.Text!="" && this.cbo_InputCols.Text!="")
			{
				string[] ArrTemp=null;
				string[] ArrTemp1=null;
				ArrTemp=cbo_ReturnCols.Text.Split(':');
				ArrTemp1=cbo_InputCols.Text.Split(':');
				int a=ArrTemp.Length ;
				int b=ArrTemp1.Length ;
				if (a!=b)
						{
					System.Windows.Forms.MessageBox.Show("参照返回列数不等于目标对应列数,请重新设置！","提示",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Warning);

						 return null;
						}

				newCellAttrib.RefertoType =sArrTemp[0]+","+this.cbo_ReturnCols.Text+","+this.cbo_InputCols.Text;
			}

			newCellAttrib.RefertoDataSource =this.txt_RefertoDataSource.Text;



			newCellAttrib.CodeToName =this.txt_CodeToName.Text ;
			sArrTemp=this.cbo_Check.Text.Split('=');
			newCellAttrib.CheckType =sArrTemp[0];
			  
			if (this.cbo_Save.Text.ToLower()=="true")
			{
				newCellAttrib.NotSave =true;
			}
			else
			{
				newCellAttrib.NotSave =false;
			}

			newCellAttrib.ColExpress =txt_Express.Text ;
			if (this.cbo_ColSum.Text.ToLower()=="true")
			{
				newCellAttrib.ColSum =true;
			}
			else
			{
				newCellAttrib.ColSum =false;
			}
			newCellAttrib.ShowFormat  =cbo_ShowFormat.Text ;
			if (this.cbo_NoDataBind.Text.ToLower()=="true")
			{
				newCellAttrib.NoDataBind =true;
			}
			else
			{
				newCellAttrib.NoDataBind =false;
			}

			string s=newCellAttrib.GetFormatString();
           return s;

		}


		private void cmd_Clear_Click(object sender, System.EventArgs e)
		{
			this.cbo_TextAlign.Text="<";
			this.txt_Caption.Text="";
			this.cbo_Default.Text =""; 
			this.txt_CodeToName.Text ="";
            this.cbo_ReadOnly.Text ="False";
			this.cbo_Referto.Text ="";
			this.cbo_Save.Text  ="";
			this.cbo_Check.Text ="";
			this.txt_Express.Text  ="";
			this.cbo_ColSum.Text  ="";
			this.txt_RefertoDataSource.Text  ="";
			this.cbo_NoDataBind.Text ="";
		}

		/// <summary>
		/// 获取字符串
		/// </summary>
		public string GetFormatString()
		{
			string s="";
			for (int r=1;r<grd_Edit.Rows;r++)
			{
				s=s+grd_Edit.GetCellText(r,2) +"|";
			}
			return s.Substring(0,s.Length-1);
		}

		private void cmd_OK_Click(object sender, System.EventArgs e)
		{
				m_FormatString=GetFormatString();
			this.Close();

		}

		private void grd_Edit_Cell_Click(object sender, System.EventArgs e)
		{

		}

		private void grd_Edit_Row_Click(object sender, System.EventArgs e)
		{
			GetGridText(grd_Edit.GetCellText(grd_Edit.Row,2));
		}

		private void cmd_Edit_Click(object sender, System.EventArgs e)
		{
			grd_Edit.SetCellText(grd_Edit.Row,1,this.txt_Caption.Text);
			grd_Edit.SetCellText(grd_Edit.Row,2,GetTextString());
		}

		private void groupBox1_Enter(object sender, System.EventArgs e)
		{
		
		}

		private void cbo_Referto_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}

		private void cmd_SQL_Click(object sender, System.EventArgs e)
		{
			frmDataTable f=new frmDataTable();
			f.Show() ;

		}

		private void cmd_ProcedureSetup_Click(object sender, System.EventArgs e)
		{
			frmProcedureInf f=new frmProcedureInf();
			f.Show();
		}


	}
}
