using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Reflection;
using JXC_MIS.MyClass;
using JXC_MIS.DataTier ;
using JXC_MIS.UserTier.BaseForm ;
using JXC_MIS.UserTier.NewForm  ;
using JXC_MIS.UserTier.CommonForm  ;
using JXC_MIS.UserTier.ToolForm  ;



//msdn 搜索
//http://search.microsoft.com/search/results.aspx?na=81&st=a&View=zh-cn&qp=&qa=&qn=&c=&s=4&qu=listView
//Internal 内部的
//private  私有的
//public   公用的
//protected保护的
//
namespace JXC_MIS.UserTier.CommonForm
{
	/// <summary>
	/// frmMain 的摘要说明。
	/// </summary>
	public class frmMain : System.Windows.Forms.Form
	{
		//当前被激活的MDI子窗口下标

		private int m_CurActiveMdiChildIndex;
		private const int WINDOW_MNU_FIXEDITEM_COUNT		= 8;
		private System.Windows.Forms.TreeView tre_MainMenu;
		private System.Windows.Forms.ToolBarButton toolBarButton1;
		ClsAccess AdoAccess=new ClsAccess();
		ClsDataBaseAccess AdoDB=new ClsDataBaseAccess();
		ClsDataBase newDb=new ClsDataBase();
		ClsInitData InitData=new ClsInitData();

		private System.Windows.Forms.StatusBar sbr_SysStatus;
		private System.Windows.Forms.ToolBar tbr_MainTool;
		private System.Windows.Forms.MainMenu SysMainMenu;
		private System.Windows.Forms.ImageList img_ImageList;
		private System.Windows.Forms.ToolBarButton toolBarButton2;
		private System.Windows.Forms.ToolBarButton toolBarButton3;
		private System.Windows.Forms.ToolBarButton toolBarButton4;
		private System.Windows.Forms.ToolBarButton toolBarButton5;
		private System.Windows.Forms.StatusBarPanel sbp_Operator;
		private System.Windows.Forms.StatusBarPanel sbp_LoginDate;
		private System.Windows.Forms.StatusBarPanel spb_1;
		private System.Windows.Forms.StatusBarPanel spb_2;
		private System.Windows.Forms.StatusBarPanel spb_5;
		private System.Windows.Forms.ToolBarButton toolBarButton6;
		private System.Windows.Forms.ToolBarButton toolBarButton7;
		private System.ComponentModel.IContainer components;

		public frmMain()
		{
			//
			// 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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
			this.tre_MainMenu = new System.Windows.Forms.TreeView();
			this.sbr_SysStatus = new System.Windows.Forms.StatusBar();
			this.spb_1 = new System.Windows.Forms.StatusBarPanel();
			this.spb_2 = new System.Windows.Forms.StatusBarPanel();
			this.sbp_Operator = new System.Windows.Forms.StatusBarPanel();
			this.sbp_LoginDate = new System.Windows.Forms.StatusBarPanel();
			this.spb_5 = new System.Windows.Forms.StatusBarPanel();
			this.tbr_MainTool = new System.Windows.Forms.ToolBar();
			this.toolBarButton6 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton3 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton4 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton5 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton7 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
			this.img_ImageList = new System.Windows.Forms.ImageList(this.components);
			this.SysMainMenu = new System.Windows.Forms.MainMenu();
			((System.ComponentModel.ISupportInitialize)(this.spb_1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.spb_2)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.sbp_Operator)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.sbp_LoginDate)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.spb_5)).BeginInit();
			this.SuspendLayout();
			// 
			// tre_MainMenu
			// 
			this.tre_MainMenu.BackColor = System.Drawing.Color.Honeydew;
			this.tre_MainMenu.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.tre_MainMenu.FullRowSelect = true;
			this.tre_MainMenu.HotTracking = true;
			this.tre_MainMenu.ImageIndex = -1;
			this.tre_MainMenu.Location = new System.Drawing.Point(0, 30);
			this.tre_MainMenu.Name = "tre_MainMenu";
			this.tre_MainMenu.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
																					 new System.Windows.Forms.TreeNode("管理信息系统", new System.Windows.Forms.TreeNode[] {
																																										 new System.Windows.Forms.TreeNode("报表管理"),
																																										 new System.Windows.Forms.TreeNode("采购管理", new System.Windows.Forms.TreeNode[] {
																																																														   new System.Windows.Forms.TreeNode("采购单"),
																																																														   new System.Windows.Forms.TreeNode("到货单")}),
																																										 new System.Windows.Forms.TreeNode("单据设置"),
																																										 new System.Windows.Forms.TreeNode("库存管理", new System.Windows.Forms.TreeNode[] {
																																																														   new System.Windows.Forms.TreeNode("出库单"),
																																																														   new System.Windows.Forms.TreeNode("调拨单"),
																																																														   new System.Windows.Forms.TreeNode("入库单"),
																																																														   new System.Windows.Forms.TreeNode("生产计划单")}),
																																										 new System.Windows.Forms.TreeNode("审核管理", new System.Windows.Forms.TreeNode[] {
																																																														   new System.Windows.Forms.TreeNode("出库审核"),
																																																														   new System.Windows.Forms.TreeNode("销售审核")}),
																																										 new System.Windows.Forms.TreeNode("销售管理", new System.Windows.Forms.TreeNode[] {
																																																														   new System.Windows.Forms.TreeNode("合同评审报告"),
																																																														   new System.Windows.Forms.TreeNode("送货单"),
																																																														   new System.Windows.Forms.TreeNode("销售单"),
																																																														   new System.Windows.Forms.TreeNode("销售合同"),
																																																														   new System.Windows.Forms.TreeNode("销售合同"),
																																																														   new System.Windows.Forms.TreeNode("销售意向单")}),
																																										 new System.Windows.Forms.TreeNode("帐务管理", new System.Windows.Forms.TreeNode[] {
																																																														   new System.Windows.Forms.TreeNode("期初收款单"),
																																																														   new System.Windows.Forms.TreeNode("其他收款"),
																																																														   new System.Windows.Forms.TreeNode("销售收款"),
																																																														   new System.Windows.Forms.TreeNode("销售预付款")}),
																																										 new System.Windows.Forms.TreeNode("质量管理", new System.Windows.Forms.TreeNode[] {
																																																														   new System.Windows.Forms.TreeNode("验质单")})}),
																					 new System.Windows.Forms.TreeNode("退出")});
			this.tre_MainMenu.SelectedImageIndex = -1;
			this.tre_MainMenu.Size = new System.Drawing.Size(170, 560);
			this.tre_MainMenu.Sorted = true;
			this.tre_MainMenu.TabIndex = 1;
			this.tre_MainMenu.Visible = false;
			this.tre_MainMenu.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tre_MainMenu_MouseDown);
			this.tre_MainMenu.Click += new System.EventHandler(this.tre_MainMenu_Click);
			// 
			// sbr_SysStatus
			// 
			this.sbr_SysStatus.Location = new System.Drawing.Point(0, 612);
			this.sbr_SysStatus.Name = "sbr_SysStatus";
			this.sbr_SysStatus.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
																							 this.spb_1,
																							 this.spb_2,
																							 this.sbp_Operator,
																							 this.sbp_LoginDate,
																							 this.spb_5});
			this.sbr_SysStatus.ShowPanels = true;
			this.sbr_SysStatus.Size = new System.Drawing.Size(776, 27);
			this.sbr_SysStatus.TabIndex = 3;
			// 
			// spb_1
			// 
			this.spb_1.Icon = ((System.Drawing.Icon)(resources.GetObject("spb_1.Icon")));
			this.spb_1.Width = 40;
			// 
			// spb_2
			// 
			this.spb_2.Width = 200;
			// 
			// sbp_Operator
			// 
			this.sbp_Operator.Icon = ((System.Drawing.Icon)(resources.GetObject("sbp_Operator.Icon")));
			this.sbp_Operator.Text = "刘金山";
			// 
			// sbp_LoginDate
			// 
			this.sbp_LoginDate.Icon = ((System.Drawing.Icon)(resources.GetObject("sbp_LoginDate.Icon")));
			this.sbp_LoginDate.Text = "2004-09-28";
			this.sbp_LoginDate.Width = 160;
			// 
			// spb_5
			// 
			this.spb_5.Icon = ((System.Drawing.Icon)(resources.GetObject("spb_5.Icon")));
			this.spb_5.Text = "数据服务器：\\\\Flow\\\\MISDB";
			this.spb_5.Width = 500;
			// 
			// tbr_MainTool
			// 
			this.tbr_MainTool.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
			this.tbr_MainTool.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
			this.tbr_MainTool.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
																							this.toolBarButton6,
																							this.toolBarButton2,
																							this.toolBarButton3,
																							this.toolBarButton4,
																							this.toolBarButton5,
																							this.toolBarButton7,
																							this.toolBarButton1});
			this.tbr_MainTool.ButtonSize = new System.Drawing.Size(80, 22);
			this.tbr_MainTool.DropDownArrows = true;
			this.tbr_MainTool.ImageList = this.img_ImageList;
			this.tbr_MainTool.Location = new System.Drawing.Point(0, 0);
			this.tbr_MainTool.Name = "tbr_MainTool";
			this.tbr_MainTool.ShowToolTips = true;
			this.tbr_MainTool.Size = new System.Drawing.Size(776, 28);
			this.tbr_MainTool.TabIndex = 4;
			this.tbr_MainTool.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
			// 
			// toolBarButton6
			// 
			this.toolBarButton6.ImageIndex = 0;
			this.toolBarButton6.Tag = "刷新";
			this.toolBarButton6.ToolTipText = "菜单项刷新";
			// 
			// toolBarButton2
			// 
			this.toolBarButton2.ImageIndex = 5;
			this.toolBarButton2.Tag = "导航";
			this.toolBarButton2.ToolTipText = "导航";
			// 
			// toolBarButton3
			// 
			this.toolBarButton3.ImageIndex = 4;
			this.toolBarButton3.Tag = "重新登录";
			this.toolBarButton3.ToolTipText = "重新登录";
			// 
			// toolBarButton4
			// 
			this.toolBarButton4.ImageIndex = 1;
			this.toolBarButton4.Tag = "计算器";
			this.toolBarButton4.ToolTipText = "计算器";
			// 
			// toolBarButton5
			// 
			this.toolBarButton5.ImageIndex = 6;
			this.toolBarButton5.Tag = "换背景";
			this.toolBarButton5.ToolTipText = "换背景";
			// 
			// toolBarButton7
			// 
			this.toolBarButton7.ImageIndex = 1;
			this.toolBarButton7.Tag = "IE";
			this.toolBarButton7.ToolTipText = "IE浏览器";
			// 
			// toolBarButton1
			// 
			this.toolBarButton1.ImageIndex = 7;
			this.toolBarButton1.Tag = "退出";
			this.toolBarButton1.ToolTipText = "退出系统";
			// 
			// img_ImageList
			// 
			this.img_ImageList.ImageSize = new System.Drawing.Size(16, 16);
			this.img_ImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("img_ImageList.ImageStream")));
			this.img_ImageList.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// frmMain
			// 
			this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(776, 639);
			this.Controls.Add(this.tbr_MainTool);
			this.Controls.Add(this.sbr_SysStatus);
			this.Controls.Add(this.tre_MainMenu);
			this.IsMdiContainer = true;
			this.Menu = this.SysMainMenu;
			this.Name = "frmMain";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "管理信息系统";
			this.Resize += new System.EventHandler(this.frmMain_Resize);
			this.Closing += new System.ComponentModel.CancelEventHandler(this.frmMain_Closing);
			this.Load += new System.EventHandler(this.frmMain_Load);
			this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.frmMain_MouseMove);
			((System.ComponentModel.ISupportInitialize)(this.spb_1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.spb_2)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.sbp_Operator)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.sbp_LoginDate)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.spb_5)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
//		/// <summary>
//		/// 应用程序的主入口点。
//		/// </summary>
//		[STAThread]
//		static void Main() 
//		{
//			Application.Run(new frmMain());
//		}
		private void frmMain_Load(object sender, System.EventArgs e)
		{
			frmAbout fa = new frmAbout();
			fa.Show();

			frmLogIn f=new frmLogIn();
			f.ShowDialog();
			sbr_SysStatus.Panels[2].Text =GlobalData.Operator; 
			sbr_SysStatus.Panels[3].Text =GlobalData.LoginDate; 

			sbr_SysStatus.Panels[4].Text ="数据服务器：\\\\"+GlobalData.DBServer+"\\\\"+GlobalData.DBName  ; 
			tre_MainMenu.ExpandAll() ;
			MenuRefresh();
			
			fa.Close();
			fa.Dispose();

			MessageBox.Show("由于各种原因，暂提供完整的采购配置和其它部分配置，请不要将任何数据用于商业用途！","WebMIS",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
		}
		private void MenuRefresh()
		{
			InitMainMenu(newDb.GetDataArray(AdoDB.GetDataSet("Sys_ProMenuItem '"+GlobalData.Operator+"'")));
		}
		private void InitMainMenu(string[,] p_Arrary)
		{
			//加载 fcNodeId, fcMenuCaption, fiLevel,fbEnabled,fbVisible
			//			p_Arrary[i,0]  代码
			//			p_Arrary[i,1]  名称
			//			p_Arrary[i,2]  级别标志
			//			p_Arrary[i,3]  是否可用
			//			p_Arrary[i,4]  是否可见
			//			p_Arrary[i,5]  快捷键
			//			p_Arrary[i,6]  连接窗体
			//			p_Arrary[i,7]  操作权限（只读、可编辑）
			SysMainMenu.MenuItems.Clear();
			MenuItem MnuParent1 = new MenuItem();
			MenuItem MnuParent2 = new MenuItem();
			MenuItem MnuParent3 = new MenuItem();
			MenuItem MnuParent4 = new MenuItem();

			try
			{
				for (int i = 0 ; i < p_Arrary.GetUpperBound(0)+1  ; i++ )
				{
					if (p_Arrary[i,1]=="" || p_Arrary[i,1]==null)
					{
					}
					else
					{
						MenuItem MnuNew = new MenuItem();
						switch (p_Arrary[i,2])
						{
							case "1":
								MnuNew= SysMainMenu.MenuItems.Add ( p_Arrary[i,1] , new EventHandler ( Mnu_NewMenuItem_Click) ) ;
								MnuNew.Enabled =true;
								if (p_Arrary[i,3]=="False" || p_Arrary[i,3]=="0") {MnuNew.Enabled =false;}
								if (p_Arrary[i,4]=="False" || p_Arrary[i,4]=="0") {MnuNew.Visible =false;}
								if (p_Arrary[i,1]=="【窗口】") {MnuNew.MdiList=true; }
//								System.Windows.Forms.Shortcut sc=new System.Windows.Forms.Shortcut();
////							Type sc = Type.GetType("System.Windows.Forms.Shortcut");
////								System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly(type);
////								object shortcut = assembly.CreateInstance(type.ToString());
//								MnuNew.Shortcut= sc.GetField("F1");
								MnuParent1=MnuNew;
								break;

							case "2":
								MnuNew= MnuParent1.MenuItems.Add ( p_Arrary[i,1] , new EventHandler ( Mnu_NewMenuItem_Click) ) ;
								MnuNew.Enabled =true;
								if (p_Arrary[i,3]=="False" || p_Arrary[i,3]=="0") {MnuNew.Enabled =false;}
								if (p_Arrary[i,4]=="False" || p_Arrary[i,4]=="0") {MnuNew.Visible =false;}
								MnuParent2=MnuNew;
								break;

							case "3":
								MnuNew= MnuParent2.MenuItems.Add ( p_Arrary[i,1] , new EventHandler ( Mnu_NewMenuItem_Click) ) ;
								MnuParent3=MnuNew;
								MnuNew.Enabled =true;
								if (p_Arrary[i,3]=="False" || p_Arrary[i,3]=="0") {MnuNew.Enabled =false;}
								if (p_Arrary[i,4]=="False" || p_Arrary[i,4]=="0") {MnuNew.Visible =false;}
								break;

							case "4":
								MnuNew= MnuParent3.MenuItems.Add ( p_Arrary[i,1] , new EventHandler ( Mnu_NewMenuItem_Click) ) ;
								MnuParent4=MnuNew;
								break;
							default:
								break;
						}
					}
				}

//				p_Arrary=null;
			}
			catch
			{
				return;
			}
		
		}
		private void tre_MainMenu_Click(object sender, System.EventArgs e)
		{
			TreeNode tn = new TreeNode();
			tn = tre_MainMenu.SelectedNode;
			if (tn != null)
			{
				SystemClickEvent(tn.Text);
			}

		}

		private void tre_MainMenu_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			tre_MainMenu.SelectedNode = tre_MainMenu.GetNodeAt(e.X,e.Y);				
		}

		private void btnClose_Click(object sender, System.EventArgs e)
		{
		Application.Exit ( ) ;
		}

		private void mnuExit_Click(object sender, System.EventArgs e)
		{
			Application.Exit ( ) ;
		}
		
		/// <summary>
		/// 显示当前MDI子窗口
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected void ShowActiveMdiChild(object sender, System.EventArgs e)
		{
			string text;
			int index;
			System.Windows.Forms.MenuItem mnuitm = new System.Windows.Forms.MenuItem();
			
			mnuitm = (System.Windows.Forms.MenuItem)sender;
			text = mnuitm.Text;
			text = text.Substring(0,text.IndexOf("."));
			index = int.Parse(text);
			
			//MDI子窗口顺序是0、1、2、3、4。。。，而所加菜单顺序为。。。3+1、2+1、1+1、0+1，正好顺序相反，故只需相减
			this.MdiChildren[this.MdiChildren.Length-(index-1)-1].Activate();
			//设置一个窗体级变量记录当前的MDI子窗口下标
			m_CurActiveMdiChildIndex = index-1;
		}
	

		/// <summary>
		/// 关闭所有MDI子窗口
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected void CloseAllMdiChildren()
		{
			System.Windows.Forms.Form actForm = new System.Windows.Forms.Form();
			
			if (this.ActiveMdiChild != null)
			{
				actForm = this.ActiveMdiChild;
				actForm.Close();
				CloseAllMdiChildren();
			}

		}
		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			switch (e.Button.Tag.ToString())
			{
				case "IE":
					System.Diagnostics.Process.Start("IEXPLORE.EXE","www.webmis.com.cn");
					System.Diagnostics.Process.Start("IEXPLORE.EXE","www.webmis.net.cn");
					break;
				case "导航":
					break;
				case "重新登录":
					break;
				case "计算器":
					System.Diagnostics.Process  msgProcess  =  new  System.Diagnostics.Process();  
					msgProcess.StartInfo.CreateNoWindow  =  true;//new  line  added  
					msgProcess.StartInfo.FileName  =Application.StartupPath+"\\calc.exe";
					msgProcess.Start();
					break;
				case "退出":
					this.Close();
					break;
				case "刷新":
					MenuRefresh();
					break;
				default:
 
					break;	
			}
		}

		private void Mnu_NewMenuItem_Click(object sender, System.EventArgs e)
		{
			this.Cursor = Cursors.WaitCursor;
			String s = sender.ToString ( ) ;
			System.Windows.Forms.MenuItem mnuitm = new System.Windows.Forms.MenuItem();
			mnuitm = (System.Windows.Forms.MenuItem)sender;
//			MessageBox.Show ( "你选择的是 " + s, "菜单选择窗口！" , MessageBoxButtons.OK , MessageBoxIcon.Information ) ;
			SystemClickEvent(mnuitm.Text);
			this.Cursor = Cursors.Default ;
		}

		private void SystemClickEvent(string p_Item)
		{
			try
			{
				switch (p_Item)
				{
					case "平铺":
						if (this.ActiveMdiChild != null)
							this.ActiveMdiChild.WindowState = System.Windows.Forms.FormWindowState.Maximized;
						break;
					case "层叠显示":
						this.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade);			//层叠窗口
						break;
					case "水平平铺":
						this.LayoutMdi(System.Windows.Forms.MdiLayout.TileHorizontal);	//水平平铺
						break;		
					case "垂直平铺":
						this.LayoutMdi(System.Windows.Forms.MdiLayout.TileVertical);	//垂直平铺
						break;
					case "关闭所有子窗口":
					      CloseAllMdiChildren();
						break;
					case "退出":
						this.Close();
						break;
					default:
						Form f=new Form();
						string strFormName ="";  //JXC_MIS.UserTier.ToolForm.frmReceiptSetup
						System.Data.DataSet dst = new System.Data.DataSet();
						dst =AdoDB.GetDataSet("SELECT fcLoadFormName FROM S_MenuItem  Where fcMenuCaption='"+p_Item+"'");
						int rs=dst.Tables[0].Rows.Count ;
						System.Data.DataRow dr =null;
						if (rs>0)
						{
							dr = dst.Tables[0].Rows[0];
							strFormName =dr[0].ToString();
						}
						if (strFormName=="")
						{
							MessageBox.Show("没有找到可运行的窗体！或者是由于某种原因作者暂不提供，请联系作者！\n\n作者Email：goldmountain@163.com、flygoldfish@163.com \n更新网址：www.webmis.net.cn / www.webmis.com.cn", "菜单提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
							return;
						}
						sbr_SysStatus.Panels[1].Text= p_Item;
						f=(Form)InitData.LoadForm(strFormName);
						f.MdiParent = this;
						f.Text= p_Item;
						f.Show();
							
						break;
				}
			}
			catch(System.Exception ex)
			{
				MessageBox.Show(ex.Message.ToString(), "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
				return;
			}
		}

		
		private void frmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			string message = "确定退出本系统吗?";
			string caption = "MIS信息管理系统";
			MessageBoxButtons buttons = MessageBoxButtons.YesNo;
			DialogResult result;
			// Displays the MessageBox.
			result = MessageBox.Show(this, message, caption, buttons,
				MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); 
			//				MessageBoxOptions.DefaultDesktopOnly);

			if(result == DialogResult.Yes)
			{
				Application.Exit ( ) ;
				System.GC.Collect();
			}
			else
			{
				e.Cancel=true;
			}

		}
		/// <summary>
		/// 显示关于对话框
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected void ShowAbout()
		{
			frmAbout newFrmAbout=new frmAbout();
			newFrmAbout.Text = "关于WebMIS.Net快速开发平台";
			newFrmAbout.Product = "作者 长江支流 流金岁月" + "\n" + "版权所有";
			newFrmAbout.Version = "版本：源码免费版";
			newFrmAbout.Descript = "描述：" + "\n" + "不写一行程序，配置MIS、ERP，将主要精力放在业务上，解放代码生产力！";
			//			newFrmAbout.Warning = "";
			newFrmAbout.User = "" ;
			newFrmAbout.Show ();
		}

		private void frmMain_Resize(object sender, System.EventArgs e)
		{
			tre_MainMenu.Height =this.Height -tre_MainMenu.Top -this.sbr_SysStatus.Height*3 ;
		}

		private void frmMain_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
//			sbr_SysStatus.Panels[1].Text =e.X.ToString() +"    "+e.Y.ToString();     
		}













	}
}
