using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO; 
using JXC_MIS.MyClass;
namespace JXC_MIS.UserTier.CommonForm
{
	/// <summary>
	/// frmDataSelect 的摘要说明。
	/// </summary>
	public class frmDataSelect : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ColumnHeader columnHeader1;
		private System.Windows.Forms.ColumnHeader columnHeader2;
		private System.Windows.Forms.ColumnHeader columnHeader3;
		private System.Windows.Forms.ColumnHeader columnHeader4;
		private System.Windows.Forms.ColumnHeader columnHeader5;
		private System.Windows.Forms.ColumnHeader columnHeader6;
		private System.Windows.Forms.ColumnHeader columnHeader7;
		private System.Windows.Forms.ColumnHeader columnHeader8;
		private System.Windows.Forms.Splitter spt_splitter;
		private System.Windows.Forms.ListView lv_ListBottom;
		private System.Windows.Forms.ListView lv_ListTop;
		private System.Windows.Forms.TextBox txt_QueryValue;
//		private static string driveLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
//		// 用于列举驱动器盘符
//		private DirectoryInfo folder; // 用于保存目录信息 
		ClsInitData InitData=new ClsInitData();

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmDataSelect()
		{
			//
			// 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.lv_ListTop = new System.Windows.Forms.ListView();
			this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
			this.lv_ListBottom = new System.Windows.Forms.ListView();
			this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
			this.spt_splitter = new System.Windows.Forms.Splitter();
			this.txt_QueryValue = new System.Windows.Forms.TextBox();
			this.SuspendLayout();
			// 
			// lv_ListTop
			// 
			this.lv_ListTop.AllowColumnReorder = true;
			this.lv_ListTop.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lv_ListTop.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																						 this.columnHeader1,
																						 this.columnHeader2,
																						 this.columnHeader3,
																						 this.columnHeader4});
			this.lv_ListTop.Dock = System.Windows.Forms.DockStyle.Top;
			this.lv_ListTop.GridLines = true;
			this.lv_ListTop.HideSelection = false;
			this.lv_ListTop.HoverSelection = true;
			this.lv_ListTop.LabelEdit = true;
			this.lv_ListTop.Location = new System.Drawing.Point(0, 0);
			this.lv_ListTop.Name = "lv_ListTop";
			this.lv_ListTop.Size = new System.Drawing.Size(718, 148);
			this.lv_ListTop.Sorting = System.Windows.Forms.SortOrder.Ascending;
			this.lv_ListTop.TabIndex = 1;
			this.lv_ListTop.View = System.Windows.Forms.View.Details;
			// 
			// columnHeader1
			// 
			this.columnHeader1.Text = "代码1";
			// 
			// columnHeader2
			// 
			this.columnHeader2.Text = "名称";
			this.columnHeader2.Width = 92;
			// 
			// columnHeader3
			// 
			this.columnHeader3.Text = "规格";
			// 
			// columnHeader4
			// 
			this.columnHeader4.Text = "数量";
			this.columnHeader4.Width = 40;
			// 
			// lv_ListBottom
			// 
			this.lv_ListBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
			this.lv_ListBottom.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lv_ListBottom.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																							this.columnHeader5,
																							this.columnHeader6,
																							this.columnHeader7,
																							this.columnHeader8});
			this.lv_ListBottom.FullRowSelect = true;
			this.lv_ListBottom.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
			this.lv_ListBottom.HideSelection = false;
			this.lv_ListBottom.HoverSelection = true;
			this.lv_ListBottom.Location = new System.Drawing.Point(0, 177);
			this.lv_ListBottom.Name = "lv_ListBottom";
			this.lv_ListBottom.Size = new System.Drawing.Size(718, 251);
			this.lv_ListBottom.TabIndex = 3;
			this.lv_ListBottom.View = System.Windows.Forms.View.Details;
			this.lv_ListBottom.DoubleClick += new System.EventHandler(this.lv_ListBottom_DoubleClick);
			// 
			// columnHeader5
			// 
			this.columnHeader5.Text = "代码2";
			// 
			// columnHeader6
			// 
			this.columnHeader6.Text = "名称";
			this.columnHeader6.Width = 92;
			// 
			// columnHeader7
			// 
			this.columnHeader7.Text = "规格";
			// 
			// columnHeader8
			// 
			this.columnHeader8.Text = "数量";
			this.columnHeader8.Width = 40;
			// 
			// spt_splitter
			// 
			this.spt_splitter.Cursor = System.Windows.Forms.Cursors.HSplit;
			this.spt_splitter.Dock = System.Windows.Forms.DockStyle.Top;
			this.spt_splitter.Location = new System.Drawing.Point(0, 169);
			this.spt_splitter.Name = "spt_splitter";
			this.spt_splitter.Size = new System.Drawing.Size(718, 6);
			this.spt_splitter.TabIndex = 2;
			this.spt_splitter.TabStop = false;
			this.spt_splitter.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.spt_splitter_SplitterMoved);
			// 
			// txt_QueryValue
			// 
			this.txt_QueryValue.Dock = System.Windows.Forms.DockStyle.Top;
			this.txt_QueryValue.Location = new System.Drawing.Point(0, 148);
			this.txt_QueryValue.Name = "txt_QueryValue";
			this.txt_QueryValue.Size = new System.Drawing.Size(718, 21);
			this.txt_QueryValue.TabIndex = 0;
			this.txt_QueryValue.Text = "请输入查询值";
			// 
			// frmDataSelect
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(718, 429);
			this.Controls.Add(this.spt_splitter);
			this.Controls.Add(this.txt_QueryValue);
			this.Controls.Add(this.lv_ListBottom);
			this.Controls.Add(this.lv_ListTop);
			this.Name = "frmDataSelect";
			this.Text = "库存选择参照";
			this.Load += new System.EventHandler(this.frmDataSelect_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void frmDataSelect_Load(object sender, System.EventArgs e)
		{
			this.Controls.AddRange(new System.Windows.Forms.Control[] {lv_ListTop, spt_splitter, lv_ListBottom});
//			fillTree();
			string [,] sArray=new string[30,4];
			//			for (int r=0;r<20;r++)
			//			{
			//			
			//				for (int c=0;c<4;c++)
			//				{
			//					sArray[r,c]="数据项"+r.ToString()+c.ToString();
			//				
			//				}
			//			
			//			}
			//|-----代  码-------------  名       称-----------------末级标志----------- 父节点代码------|
			sArray[0,0]="代  码";	sArray[0,1]=" 名       称";	sArray[0,3]="末级标志";	sArray[0,2]="父节点代码";
			sArray[1,0]="1";		sArray[1,1]="全部11";		sArray[1,3]="1";	sArray[1,2]="1";
			sArray[2,0]="11";		sArray[2,1]="全部111";		sArray[2,3]="2";	sArray[2,2]="2";
			sArray[3,0]="111";		sArray[3,1]="全部1111";		sArray[3,3]="3";	sArray[3,2]="3";
			sArray[4,0]="12";		sArray[4,1]="全部12";		sArray[4,3]="2";	sArray[4,2]="2";
			sArray[5,0]="121";		sArray[5,1]="全部121";		sArray[5,3]="3";	sArray[5,2]="3";
			sArray[6,0]="1211";		sArray[6,1]="全部1211";		sArray[6,3]="4";	sArray[6,2]="4";
			sArray[7,0]="2";		sArray[7,1]="全部2";		sArray[7,3]="1";	sArray[7,2]="1";
			sArray[8,0]="22";		sArray[8,1]="全部21";		sArray[8,3]="2";	sArray[8,2]="2";
			sArray[9,0]="221";		sArray[9,1]="全部221";		sArray[9,3]="3";	sArray[9,2]="3";
			sArray[10,0]="222";		sArray[10,1]="全部222";		sArray[10,3]="3";	sArray[10,2]="4";
			sArray[11,0]="2211";	sArray[11,1]="全部2221";	sArray[11,3]="4";	sArray[11,2]="4";
			sArray[12,0]="3";		sArray[12,1]="全部3";		sArray[12,3]="1";	sArray[12,2]="1";
			sArray[13,0]="32";		sArray[13,1]="全部31";		sArray[13,3]="2";	sArray[13,2]="2";
			sArray[14,0]="321";		sArray[14,1]="全部321";		sArray[14,3]="3";	sArray[14,2]="3";
			sArray[15,0]="3211";	sArray[15,1]="全部32111";	sArray[15,3]="4";	sArray[15,2]="4";
			sArray[16,0]="4";		sArray[16,1]="全部4";		sArray[16,3]="1";	sArray[16,2]="1";
			sArray[17,0]="41";		sArray[17,1]="全部41";		sArray[17,3]="2";	sArray[17,2]="2";
			sArray[18,0]="411";		sArray[18,1]="全部411";		sArray[18,3]="3";	sArray[18,2]="3";
			sArray[19,0]="4111";	sArray[19,1]="全部41111";	sArray[19,3]="4";	sArray[19,2]="4";
			sArray[20,0]="0";		sArray[20,1]="全部其他";	sArray[20,3]="0";	sArray[20,2]="0";

			//|-----------------------------------------------------------------------------------------------|
			InitData.InitListView (lv_ListTop,sArray);
			InitData.InitListView (lv_ListBottom,sArray);
//			InitData.InitDriveTree (tv_Tree);

		}
		private void ChangeHeight()
		{
//			this.grdClassLevel.Refresh();		
	     this.lv_ListBottom.Height =this.Height -this.lv_ListBottom.Top -txt_QueryValue.Height ;
		}

		private void spt_splitter_Resize(object sender, System.EventArgs e)
		{
			this.ChangeHeight();
		}

		private void spt_splitter_SplitterMoved(object sender, System.Windows.Forms.SplitterEventArgs e)
		{
//			this.ChangeHeight();
		}





		private void lv_ListBottom_DoubleClick(object sender, System.EventArgs e)
		{
//			lv_ListTop.Items.Add(new ListViewItem(lv_ListBottom.SelectedItems[1],0)) ; 
//.Add (new ListViewItem(lv,0));
		} 











	}
}
