using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Test
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ToolBarButton toolBarButton11;
		private System.Windows.Forms.ListBox lstList;
		private System.Windows.Forms.ToolBarButton toolBarButton9;
		private System.Windows.Forms.ToolBarButton toolBarButton10;
		private System.Windows.Forms.Button btnDown;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.ToolBarButton toolBarButton8;
		private System.Windows.Forms.ToolBarButton toolBarButton2;
		private System.Windows.Forms.ToolBarButton toolBarButton3;
		private System.Windows.Forms.ToolBar tlb_toolBar;
		private System.Windows.Forms.ToolBarButton toolBarButton1;
		private System.Windows.Forms.ToolBarButton toolBarButton4;
		private System.Windows.Forms.ToolBarButton toolBarButton5;
		private System.Windows.Forms.ToolBarButton toolBarButton6;
		private System.Windows.Forms.ToolBarButton toolBarButton7;
		private MyGrid.MyGrid grd_Top;
		private MyGrid.MyGrid grd_Header;
		private MyGrid.MyGrid grd_Footer;
		private MyGrid.MyGrid grd_Bottom;
		private System.Windows.Forms.Label lblBorder;
		private System.Windows.Forms.DataGrid grd_Detail;
		private System.Windows.Forms.Label lblBorderIn;
		private System.Windows.Forms.TextBox txtFileNo;
		private System.Windows.Forms.ContextMenu contextMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.MenuItem menuItem6;
		private System.Windows.Forms.MenuItem menuItem7;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.TextBox Cell;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.TextBox textBox3;
		private System.Windows.Forms.TextBox textBox4;
		
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// 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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.toolBarButton11 = new System.Windows.Forms.ToolBarButton();
			this.lstList = new System.Windows.Forms.ListBox();
			this.toolBarButton9 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton10 = new System.Windows.Forms.ToolBarButton();
			this.btnDown = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.toolBarButton8 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton3 = new System.Windows.Forms.ToolBarButton();
			this.tlb_toolBar = new System.Windows.Forms.ToolBar();
			this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton4 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton5 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton6 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton7 = new System.Windows.Forms.ToolBarButton();
			this.lblBorder = new System.Windows.Forms.Label();
			this.grd_Detail = new System.Windows.Forms.DataGrid();
			this.lblBorderIn = new System.Windows.Forms.Label();
			this.txtFileNo = new System.Windows.Forms.TextBox();
			this.contextMenu1 = new System.Windows.Forms.ContextMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuItem6 = new System.Windows.Forms.MenuItem();
			this.menuItem7 = new System.Windows.Forms.MenuItem();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.Cell = new System.Windows.Forms.TextBox();
			this.textBox2 = new System.Windows.Forms.TextBox();
			this.textBox3 = new System.Windows.Forms.TextBox();
			this.textBox4 = new System.Windows.Forms.TextBox();
			((System.ComponentModel.ISupportInitialize)(this.grd_Detail)).BeginInit();
			this.SuspendLayout();
			// 
			// lstList
			// 
			this.lstList.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.lstList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lstList.ItemHeight = 12;
			this.lstList.Location = new System.Drawing.Point(276, 118);
			this.lstList.Name = "lstList";
			this.lstList.Size = new System.Drawing.Size(150, 134);
			this.lstList.TabIndex = 27;
			this.lstList.Visible = false;
			// 
			// btnDown
			// 
			this.btnDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnDown.Image = ((System.Drawing.Image)(resources.GetObject("btnDown.Image")));
			this.btnDown.Location = new System.Drawing.Point(258, 96);
			this.btnDown.Name = "btnDown";
			this.btnDown.Size = new System.Drawing.Size(20, 20);
			this.btnDown.TabIndex = 26;
			this.btnDown.Click += new System.EventHandler(this.btnDown_Click);
			// 
			// label1
			// 
			this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.label1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(316, 70);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(216, 34);
			this.label1.TabIndex = 29;
			this.label1.Text = "北京公司销售单";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// pictureBox1
			// 
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(2, 28);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(232, 110);
			this.pictureBox1.TabIndex = 25;
			this.pictureBox1.TabStop = false;
			// 
			// toolBarButton2
			// 
			this.toolBarButton2.Text = "修改";
			// 
			// toolBarButton3
			// 
			this.toolBarButton3.Text = "保存";
			// 
			// tlb_toolBar
			// 
			this.tlb_toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
			this.tlb_toolBar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.tlb_toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
																						   this.toolBarButton1,
																						   this.toolBarButton2,
																						   this.toolBarButton3,
																						   this.toolBarButton4,
																						   this.toolBarButton5,
																						   this.toolBarButton6,
																						   this.toolBarButton7,
																						   this.toolBarButton8,
																						   this.toolBarButton9,
																						   this.toolBarButton10,
																						   this.toolBarButton11});
			this.tlb_toolBar.DropDownArrows = true;
			this.tlb_toolBar.Location = new System.Drawing.Point(0, 0);
			this.tlb_toolBar.Name = "tlb_toolBar";
			this.tlb_toolBar.ShowToolTips = true;
			this.tlb_toolBar.Size = new System.Drawing.Size(830, 42);
			this.tlb_toolBar.TabIndex = 30;
			this.tlb_toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tlb_toolBar_ButtonClick);
			// 
			// toolBarButton1
			// 
			this.toolBarButton1.Text = "添加";
			// 
			// toolBarButton4
			// 
			this.toolBarButton4.Text = "删除";
			// 
			// toolBarButton5
			// 
			this.toolBarButton5.Text = "查询";
			// 
			// lblBorder
			// 
			this.lblBorder.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.lblBorder.BackColor = System.Drawing.Color.Transparent;
			this.lblBorder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lblBorder.Location = new System.Drawing.Point(28, 174);
			this.lblBorder.Name = "lblBorder";
			this.lblBorder.Size = new System.Drawing.Size(532, 258);
			this.lblBorder.TabIndex = 38;
			// 
			// grd_Detail
			// 
			this.grd_Detail.AllowDrop = true;
			this.grd_Detail.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.grd_Detail.BackgroundColor = System.Drawing.Color.White;
			this.grd_Detail.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.grd_Detail.CaptionBackColor = System.Drawing.Color.LightGray;
			this.grd_Detail.CaptionForeColor = System.Drawing.Color.Black;
			this.grd_Detail.CaptionText = "行号        产品编码                产品名称                  规格型号                         " +
				"   单位               数量                    金额                     ";
			this.grd_Detail.DataMember = "";
			this.grd_Detail.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.grd_Detail.Location = new System.Drawing.Point(466, 250);
			this.grd_Detail.Name = "grd_Detail";
			this.grd_Detail.PreferredRowHeight = 25;
			this.grd_Detail.Size = new System.Drawing.Size(300, 116);
			this.grd_Detail.TabIndex = 39;
			this.grd_Detail.MouseDown += new System.Windows.Forms.MouseEventHandler(this.grd_Detail_MouseDown);
			this.grd_Detail.Navigate += new System.Windows.Forms.NavigateEventHandler(this.grd_Detail_Navigate);
			// 
			// lblBorderIn
			// 
			this.lblBorderIn.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.lblBorderIn.BackColor = System.Drawing.Color.Transparent;
			this.lblBorderIn.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lblBorderIn.Location = new System.Drawing.Point(34, 256);
			this.lblBorderIn.Name = "lblBorderIn";
			this.lblBorderIn.Size = new System.Drawing.Size(576, 258);
			this.lblBorderIn.TabIndex = 40;
			// 
			// txtFileNo
			// 
			this.txtFileNo.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.txtFileNo.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.txtFileNo.Location = new System.Drawing.Point(664, 84);
			this.txtFileNo.Name = "txtFileNo";
			this.txtFileNo.Size = new System.Drawing.Size(166, 14);
			this.txtFileNo.TabIndex = 41;
			this.txtFileNo.Text = "文件号:DA-01-A-2004618";
			this.txtFileNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// contextMenu1
			// 
			this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem1,
																						 this.menuItem2,
																						 this.menuItem3});
			this.contextMenu1.Popup += new System.EventHandler(this.contextMenu1_Popup);
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.Text = "新增";
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = "修改";
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "保存";
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem4});
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 0;
			this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem5,
																					  this.menuItem6,
																					  this.menuItem7});
			this.menuItem4.Text = "编辑";
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 0;
			this.menuItem5.Text = "添加";
			this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
			// 
			// menuItem6
			// 
			this.menuItem6.Index = 1;
			this.menuItem6.Text = "删除";
			this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
			// 
			// menuItem7
			// 
			this.menuItem7.Index = 2;
			this.menuItem7.Text = "修改";
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(2, 546);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(234, 21);
			this.textBox1.TabIndex = 42;
			this.textBox1.Text = "textBox1";
			// 
			// Cell
			// 
			this.Cell.AutoSize = false;
			this.Cell.Cursor = System.Windows.Forms.Cursors.Arrow;
			this.Cell.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.Cell.Location = new System.Drawing.Point(548, 46);
			this.Cell.Name = "Cell";
			this.Cell.Size = new System.Drawing.Size(102, 26);
			this.Cell.TabIndex = 43;
			this.Cell.Text = "我的网格";
			this.Cell.Visible = false;
			// 
			// textBox2
			// 
			this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textBox2.Cursor = System.Windows.Forms.Cursors.Arrow;
			this.textBox2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.textBox2.Location = new System.Drawing.Point(548, 80);
			this.textBox2.Name = "textBox2";
			this.textBox2.Size = new System.Drawing.Size(102, 21);
			this.textBox2.TabIndex = 44;
			this.textBox2.Text = "我的网格";
			this.textBox2.Visible = false;
			// 
			// textBox3
			// 
			this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textBox3.Cursor = System.Windows.Forms.Cursors.Arrow;
			this.textBox3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.textBox3.Location = new System.Drawing.Point(652, 46);
			this.textBox3.Name = "textBox3";
			this.textBox3.Size = new System.Drawing.Size(102, 21);
			this.textBox3.TabIndex = 45;
			this.textBox3.Text = "我的网格";
			this.textBox3.Visible = false;
			// 
			// textBox4
			// 
			this.textBox4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textBox4.Cursor = System.Windows.Forms.Cursors.Arrow;
			this.textBox4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.textBox4.Location = new System.Drawing.Point(652, 66);
			this.textBox4.Name = "textBox4";
			this.textBox4.Size = new System.Drawing.Size(102, 21);
			this.textBox4.TabIndex = 46;
			this.textBox4.Text = "我的网格";
			this.textBox4.Visible = false;
			// 
			// Form1
			// 
			this.AutoScale = false;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.Color.White;
			this.ClientSize = new System.Drawing.Size(830, 567);
			this.Controls.Add(this.textBox2);
			this.Controls.Add(this.textBox4);
			this.Controls.Add(this.textBox3);
			this.Controls.Add(this.Cell);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.txtFileNo);
			this.Controls.Add(this.lstList);
			this.Controls.Add(this.grd_Detail);
			this.Controls.Add(this.btnDown);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.tlb_toolBar);
			this.Controls.Add(this.lblBorderIn);
			this.Controls.Add(this.lblBorder);
			this.Controls.Add(this.pictureBox1);
			this.ForeColor = System.Drawing.Color.DarkBlue;
			this.Menu = this.mainMenu1;
			this.Name = "Form1";
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);
			((System.ComponentModel.ISupportInitialize)(this.grd_Detail)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

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

			InitInterface();
		}
		private void InitInterface()
		{

			grd_Header.BorderStyle=true;
			grd_Header.GridStyle=true;
			grd_Header.Cols=6;
			grd_Header.Rows=2;
			grd_Header.SetCellWidth ="70,80,50,250,50,250"; 
			grd_Header.ShowGrid() ;
			grd_Header.GridSize() ;
			grd_Header.CellText(0,0,"客户代码");
			grd_Header.CellText(0,2,"客户");
			grd_Header.CellText(0,4,"地址");
			grd_Header.CellText(1,0,"联系人");
			grd_Header.CellText(1,2,"发票");
			grd_Header.CellText(1,4,"税率");
			grd_Top.BorderStyle=false;
			grd_Top.GridStyle=false;
			grd_Top.Cols=6;
			grd_Top.Rows=1;
			grd_Top.SetCellWidth ="50,250,50,150,50,200"; 
			grd_Top.ShowGrid() ;
			grd_Top.GridSize() ;

			grd_Top.CellText(0,0,"日期：");
			grd_Top.CellText(0,2,"制单人：");
			grd_Top.CellText(0,4,"编号：");

			grd_Footer.GridStyle=true;
			grd_Footer.BorderStyle=true;
			grd_Footer.Cols=4;
			grd_Footer.Rows=2;
			grd_Footer.SetCellWidth ="100,400,100,150"; 
			grd_Footer.ShowGrid() ;
			grd_Footer.GridSize() ;

			grd_Footer.CellText(0,0,"合计大写金额");
			grd_Footer.CellText(0,2,"合计（小写）");
			grd_Footer.CellText(1,0,"部门");
			grd_Footer.CellText(1,2,"业务员");


			grd_Bottom.GridStyle=false;
			grd_Bottom.Cols=6;
			grd_Bottom.Rows=1;
			grd_Bottom.SetCellWidth ="50,250,50,250,50,100"; 
			grd_Bottom.CellForeColor=Color.Red  ;
			grd_Bottom.CellBackColor=Color.Blue ;
			grd_Bottom.ShowGrid() ;
			grd_Bottom.GridSize() ;

			grd_Bottom.CellText(0,0,"库管：");
			grd_Bottom.CellText(0,2,"审核：");
			grd_Bottom.CellText(0,4,"备注：");
			GetDataTable(grd_Detail,10,10);

//			myGrid1.GridStyle=true;
//			myGrid1.BorderStyle=true;
//
//			myGrid1.Cols=6;
//			myGrid1.Rows=100;
//			myGrid1.SetCellWidth ="50,150,50,150,50,125"; 
////			myGrid1.CellRowLength =2;
//			myGrid1.CellColLength =2;
//			myGrid1.ShowGrid() ;

			lblBorder.Top =grd_Header.Top+grd_Header.Height-1  ;
			lblBorder.Left =grd_Header.Left;
			lblBorder.Width =grd_Header.Width ;
			lblBorder.Height =grd_Footer.Top -lblBorder.Top+1;//grd_Header.Height +grd_Detail.Height +grd_Footer.Height;
			lblBorderIn.Width =lblBorder.Width -4;
			lblBorderIn.Left =lblBorder.Left+2;
			lblBorderIn.Height =lblBorder.Height;
			lblBorderIn.Top=lblBorder.Top ;
			grd_Detail.Width =lblBorderIn.Width-2 ;
			grd_Detail.Left =lblBorderIn.Left+1;
			grd_Detail.Top =lblBorderIn.Top+1 ;
			grd_Detail.Height =lblBorderIn.Height-2;

			grd_Bottom.Top =grd_Footer.Top +grd_Footer.Height+2 ;


		}
		private void GetDataTable(System.Windows.Forms.DataGrid Grid,int r,int c )
		{
			DataTable dt =new DataTable();
			int intRowIndex;
			int intColIndex;
			for (intRowIndex=0;intRowIndex<r;intRowIndex++)
			{
				dt.Rows.Add(dt.NewRow());
				dt.Columns.Add();
			}	

			for (intRowIndex=0;intRowIndex<r;intRowIndex++)
			{				
				for (intColIndex=0;intColIndex<c;intColIndex++)
				{
					//					dt.Rows[intRowIndex][intColIndex]=intRowIndex.ToString()+"行"+intColIndex.ToString()+"列";
				}
				dt.Rows[intRowIndex][0]=intRowIndex;    
			}	

						Grid.DataSource=dt;
	
			
		}

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

	
		private void NewCell_Click(object sender, System.EventArgs e)
		{
//			MessageBox.Show ( grd_Header.Row.ToString()+grd_Header.Col.ToString()+" T:"+grd_Header.CellTop.ToString()+" L:"+grd_Header.CellLeft.ToString ()+ "被单击了！");
//				grd_Header.CellText(grd_Header.Row,grd_Header.Col ,"日期");
	
		}

		private void grd_Header_NewCell_Enter(object sender, System.EventArgs e)
		{
			btnDown.Top  =grd_Header.CellTop+grd_Header.Top ;
			btnDown.Left  =grd_Header.CellLeft+grd_Header.Left +grd_Header.CellWidth -btnDown.Width  ;
			btnDown.Height   =grd_Header.CellHeight ;
			btnDown.Visible =true;
		}

		private void grd_Header_NewCell_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
		
		}

		private void grd_Header_NewCell_Leave(object sender, System.EventArgs e)
		{
//			btnDown.Visible=false;
		}

		private void grd_Header_NewCell_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
//			MyGrid.MyGrid control = ( MyGrid.MyGrid ) sender ; 
			btnDown.Top  =grd_Header.CellTop+grd_Header.Top ;
			btnDown.Left  =grd_Header.CellLeft+grd_Header.Left +grd_Header.CellWidth -btnDown.Width  ;
			btnDown.Height   =grd_Header.CellHeight ;
			btnDown.Visible =true;

		}

		private void btnDown_Click(object sender, System.EventArgs e)
		{
			lstList.Top  =grd_Header.CellTop+grd_Header.Top+grd_Header.CellHeight+2 ;
			lstList.Left  =grd_Header.CellLeft+grd_Header.Left  ;
			lstList.Width   =grd_Header.CellWidth ;
			lstList.Visible =true;
//			lstList.Focused=true;
			lstList.Focus() ;

			
		}

		private void lstList_Leave(object sender, System.EventArgs e)
		{
		lstList.Visible =false;
		}

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

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

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

		private void splitter1_SplitterMoved(object sender, System.Windows.Forms.SplitterEventArgs e)
		{
		
		}

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

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

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

		private void tlb_toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
		
			Form2 Nform =new Form2() ;
			Nform.ShowDialog(this);
		}

		private void grd_Detail_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
		{
		
		}

		private void grd_Detail_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
//				string newLine = "\n";
				System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
				// Use the DataGrid control's HitTest method with the x and y properties.
				myHitTest = grd_Detail.HitTest(e.X,e.Y);
//				Console.WriteLine("Column " + myHitTest.Column);
//				textBox1.Text ="Row=" +  grd_Detail.HitTest(e.X,e.Y).Row.ToString()+" Col=" +  grd_Detail.HitTest(e.X,e.Y).Column.ToString();
			grd_Detail.CurrentCell = new DataGridCell(2,-1);

//		textBox1.Text =grd_Detail.CurrentCell.ColumnNumber.ToString(); 
		textBox1.Text =grd_Detail.CurrentCell.RowNumber.ToString(); 
		}
	}
}
