/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.navBarControl1 = new DevExpress.XtraNavBar.NavBarControl(); this.navBarGroup1 = new DevExpress.XtraNavBar.NavBarGroup(); this.navBarItem10 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarGroupControlContainer1 = new DevExpress.XtraNavBar.NavBarGroupControlContainer(); this.panel1 = new System.Windows.Forms.Panel(); this.navBarGroup2 = new DevExpress.XtraNavBar.NavBarGroup(); this.navBarItem5 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarItem6 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarItem7 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarItem8 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarItem9 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarItem11 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarGroup3 = new DevExpress.XtraNavBar.NavBarGroup(); this.navBarItem1 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarItem2 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarItem3 = new DevExpress.XtraNavBar.NavBarItem(); this.navBarItem4 = new DevExpress.XtraNavBar.NavBarItem(); this.barManager1 = new DevExpress.XtraBars.BarManager(this.components); this.barDockControlTop = new DevExpress.XtraBars.BarDockControl(); this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); this.bar1 = new DevExpress.XtraBars.Bar(); this.bar2 = new DevExpress.XtraBars.Bar(); this.bar3 = new DevExpress.XtraBars.Bar(); this.skinBarSubItem1 = new DevExpress.XtraBars.SkinBarSubItem(); this.defaultLookAndFeel1 = new DevExpress.LookAndFeel.DefaultLookAndFeel(this.components); ((System.ComponentModel.ISupportInitialize)(this.navBarControl1)).BeginInit(); this.navBarControl1.SuspendLayout(); this.navBarGroupControlContainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit(); this.SuspendLayout(); // // navBarControl1 // this.navBarControl1.ActiveGroup = this.navBarGroup1; this.navBarControl1.ContentButtonHint = null; this.navBarControl1.Controls.Add(this.navBarGroupControlContainer1); this.navBarControl1.Dock = System.Windows.Forms.DockStyle.Right; this.navBarControl1.Groups.AddRange(new DevExpress.XtraNavBar.NavBarGroup[] { this.navBarGroup1, this.navBarGroup2, this.navBarGroup3 }); this.navBarControl1.Items.AddRange(new DevExpress.XtraNavBar.NavBarItem[] { this.navBarItem1, this.navBarItem2, this.navBarItem3, this.navBarItem4, this.navBarItem5, this.navBarItem6, this.navBarItem7, this.navBarItem8, this.navBarItem9, this.navBarItem10, this.navBarItem11 }); this.navBarControl1.Location = new System.Drawing.Point(344, 49); this.navBarControl1.LookAndFeel.SkinName = "Liquid Sky"; this.navBarControl1.Name = "navBarControl1"; this.navBarControl1.OptionsNavPane.ExpandedWidth = 280; this.navBarControl1.Size = new System.Drawing.Size(280, 302); this.navBarControl1.TabIndex = 0; this.navBarControl1.Text = "navBarControl1"; // // navBarGroup1 // this.navBarGroup1.Caption = "navBarGroup1"; this.navBarGroup1.Expanded = true; this.navBarGroup1.ItemLinks.AddRange(new DevExpress.XtraNavBar.NavBarItemLink[] { new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem10) }); this.navBarGroup1.Name = "navBarGroup1"; // // navBarItem10 // this.navBarItem10.Caption = "navBarItem10"; this.navBarItem10.Name = "navBarItem10"; // // navBarGroupControlContainer1 // // this.navBarGroupControlContainer1.Appearance.ForeColor = System.Drawing.Color.Transparent; // this.navBarGroupControlContainer1.Appearance.Options.UseForeColor = true; this.navBarGroupControlContainer1.Controls.Add(this.panel1); this.navBarGroupControlContainer1.Name = "navBarGroupControlContainer1"; this.navBarGroupControlContainer1.Size = new System.Drawing.Size(272, 76); this.navBarGroupControlContainer1.TabIndex = 2; // // panel1 // this.panel1.BackColor = System.Drawing.Color.Red; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.ForeColor = System.Drawing.Color.Transparent; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(272, 76); this.panel1.TabIndex = 0; // // navBarGroup2 // this.navBarGroup2.Caption = "navBarGroup2"; this.navBarGroup2.Expanded = true; this.navBarGroup2.ItemLinks.AddRange(new DevExpress.XtraNavBar.NavBarItemLink[] { new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem5), new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem6), new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem7), new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem8), new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem9), new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem11) }); this.navBarGroup2.Name = "navBarGroup2"; // // navBarItem5 // this.navBarItem5.Caption = "navBarItem5"; this.navBarItem5.Name = "navBarItem5"; // // navBarItem6 // this.navBarItem6.Caption = "navBarItem6"; this.navBarItem6.Name = "navBarItem6"; // // navBarItem7 // this.navBarItem7.Caption = "navBarItem7"; this.navBarItem7.Name = "navBarItem7"; // // navBarItem8 // this.navBarItem8.Caption = "navBarItem8"; this.navBarItem8.Name = "navBarItem8"; // // navBarItem9 // this.navBarItem9.Caption = "navBarItem9"; this.navBarItem9.Name = "navBarItem9"; // // navBarItem11 // this.navBarItem11.Caption = "navBarItem11"; this.navBarItem11.Name = "navBarItem11"; // // navBarGroup3 // this.navBarGroup3.Caption = "navBarGroup3"; this.navBarGroup3.ControlContainer = this.navBarGroupControlContainer1; this.navBarGroup3.Expanded = true; this.navBarGroup3.GroupClientHeight = 80; this.navBarGroup3.GroupStyle = DevExpress.XtraNavBar.NavBarGroupStyle.ControlContainer; this.navBarGroup3.ItemLinks.AddRange(new DevExpress.XtraNavBar.NavBarItemLink[] { new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem1), new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem2), new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem3), new DevExpress.XtraNavBar.NavBarItemLink(this.navBarItem4) }); this.navBarGroup3.Name = "navBarGroup3"; this.navBarGroup3.CalcGroupClientHeight += new DevExpress.XtraNavBar.NavBarCalcGroupClientHeightEventHandler(this.navBarGroup3_CalcGroupClientHeight); // // navBarItem1 // this.navBarItem1.Caption = "navBarItem1"; this.navBarItem1.Name = "navBarItem1"; // // navBarItem2 // this.navBarItem2.Caption = "navBarItem2"; this.navBarItem2.Name = "navBarItem2"; // // navBarItem3 // this.navBarItem3.Caption = "navBarItem3"; this.navBarItem3.Name = "navBarItem3"; // // navBarItem4 // this.navBarItem4.Caption = "navBarItem4"; this.navBarItem4.Name = "navBarItem4"; // // barManager1 // this.barManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[] { this.bar1, this.bar2, this.bar3 }); this.barManager1.DockControls.Add(this.barDockControlTop); this.barManager1.DockControls.Add(this.barDockControlBottom); this.barManager1.DockControls.Add(this.barDockControlLeft); this.barManager1.DockControls.Add(this.barDockControlRight); this.barManager1.Form = this; this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { this.skinBarSubItem1 }); this.barManager1.MainMenu = this.bar2; this.barManager1.MaxItemId = 1; this.barManager1.StatusBar = this.bar3; // // barDockControlTop // this.barDockControlTop.CausesValidation = false; this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top; this.barDockControlTop.Location = new System.Drawing.Point(0, 0); this.barDockControlTop.Size = new System.Drawing.Size(624, 49); // // barDockControlBottom // this.barDockControlBottom.CausesValidation = false; this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; this.barDockControlBottom.Location = new System.Drawing.Point(0, 351); this.barDockControlBottom.Size = new System.Drawing.Size(624, 23); // // barDockControlLeft // this.barDockControlLeft.CausesValidation = false; this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left; this.barDockControlLeft.Location = new System.Drawing.Point(0, 49); this.barDockControlLeft.Size = new System.Drawing.Size(0, 302); // // barDockControlRight // this.barDockControlRight.CausesValidation = false; this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right; this.barDockControlRight.Location = new System.Drawing.Point(624, 49); this.barDockControlRight.Size = new System.Drawing.Size(0, 302); // // bar1 // this.bar1.BarName = "Tools"; this.bar1.DockCol = 0; this.bar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Top; this.bar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(this.skinBarSubItem1) }); this.bar1.Text = "Tools"; // // bar2 // this.bar2.BarName = "Main menu"; this.bar2.DockCol = 0; this.bar2.DockStyle = DevExpress.XtraBars.BarDockStyle.Top; this.bar2.OptionsBar.MultiLine = true; this.bar2.OptionsBar.UseWholeRow = true; this.bar2.Text = "Main menu"; // // bar3 // this.bar3.BarName = "Status bar"; this.bar3.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom; this.bar3.DockCol = 0; this.bar3.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom; this.bar3.OptionsBar.AllowQuickCustomization = false; this.bar3.OptionsBar.DrawDragBorder = false; this.bar3.OptionsBar.UseWholeRow = true; this.bar3.Text = "Status bar"; // // skinBarSubItem1 // this.skinBarSubItem1.Caption = "skinBarSubItem1"; this.skinBarSubItem1.Id = 0; this.skinBarSubItem1.Name = "skinBarSubItem1"; // // defaultLookAndFeel1 // this.defaultLookAndFeel1.EnableBonusSkins = true; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(624, 374); this.Controls.Add(this.navBarControl1); this.Controls.Add(this.barDockControlLeft); this.Controls.Add(this.barDockControlRight); this.Controls.Add(this.barDockControlBottom); this.Controls.Add(this.barDockControlTop); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.navBarControl1)).EndInit(); this.navBarControl1.ResumeLayout(false); this.navBarGroupControlContainer1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void SetLeftMenu() { try { navBarControl1.Visible = false; #region [ TXNTABLE ] DTMenu = new DataTable("TXNTABLE"); DataColumn column; column = new DataColumn(); column.DataType = System.Type.GetType("System.Int64"); column.ColumnName = "TXNCODE"; column.Unique = false; DTMenu.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "TXNNAME"; column.Unique = false; DTMenu.Columns.Add(column); #endregion System.Drawing.Font font = new System.Drawing.Font(fontname, fontsize, FontStyle.Bold); string Caption = " "; string controlname = " "; string picname = ""; int MenuType; string StrDll, StrClass, StrFunction, StrPrivNo; long trancode; int index = 2, Top = -1; object rowIndex = 2; int savetop = -1; int itemcount = 0; int subitemcount = 0; bool isSaveSubGroup = false; bool isSaveTreeSubGroup = false; NavBarGroup[] LeftMenu = new NavBarGroup[20]; NavBarItem SaveSubGroupItems = new NavBarItem(); DevExpress.XtraNavBar.NavBarGroupControlContainer[] navBarGroupControlContainer3 = new DevExpress.XtraNavBar.NavBarGroupControlContainer[20]; DevExpress.Utils.Design.DXTreeView[] treeView1 = new DevExpress.Utils.Design.DXTreeView[20]; DevExpress.Utils.Design.DXTreeView savetreeview = null; TreeNode[] RootNode = new TreeNode[20]; TreeNode SaveRootNode = null; if (_core.FontName.Trim() != "") { fontname = _core.FontName; } if (_core.FontSize != 0) { fontsize = (float)_core.FontSize; } string line; Assembly asm = Assembly.GetExecutingAssembly(); Stream str = asm.GetManifestResourceStream("InfoPos.Admin.Resources.LeftMenu.txt"); StreamReader file = new StreamReader(str); navBarControl1.Items.Clear(); navBarControl1.Groups.Clear(); int fview = 0, savefview = 0; #region [ while ] while ((line = file.ReadLine()) != null) { string[] words = line.Split(';'); MenuType = Static.ToInt(words[2]); controlname = words[5]; if (words[9] != "0") { Caption = words[9]; } //Group if (MenuType == 10 || MenuType == 0) { picname = words[3]; Top++; if (MenuType == 10) { #region [ TreeView ] treeView1[Top] = new DevExpress.Utils.Design.DXTreeView(); treeView1[Top].BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; //treeView1[Top].Dock = System.Windows.Forms.DockStyle.Fill; treeView1[Top].Size = new System.Drawing.Size(400, 322); treeView1[Top].ImageIndex = 0; treeView1[Top].ImageList = il; treeView1[Top].Location = new System.Drawing.Point(0, 0); treeView1[Top].Name = "treeView1" + Static.ToStr(Top); treeView1[Top].BackColor = navBarControl1.BackColor; treeView1[Top].NodeMouseClick += new TreeNodeMouseClickEventHandler(TreeView_NodeMouseClick); treeView1[Top].KeyDown += new KeyEventHandler(frmMain_KeyDown); //treeView1[Top]. navBarGroupControlContainer3[Top] = new DevExpress.XtraNavBar.NavBarGroupControlContainer(); navBarControl1.Controls.Add(navBarGroupControlContainer3[Top]); navBarGroupControlContainer3[Top].Controls.Add(treeView1[Top]); navBarGroupControlContainer3[Top].Name = "navBarGroupControlContainer3" + Static.ToStr(Top); navBarGroupControlContainer3[Top].Size = new System.Drawing.Size(navBarControl1.Width, 322); navBarGroupControlContainer3[Top].TabIndex = 2; LeftMenu[Top] = navBarControl1.Groups.Add(); LeftMenu[Top].Caption = Caption; if (picname != "") { LeftMenu[Top].SmallImage = _core.Resource.GetImage(picname); il.Images.Add(picname, _core.Resource.GetImage(picname)); } LeftMenu[Top].Name = controlname + Static.ToStr(Top); LeftMenu[Top].GroupStyle = NavBarGroupStyle.ControlContainer; LeftMenu[Top].ControlContainer = navBarGroupControlContainer3[Top]; LeftMenu[Top].DragDropFlags = DevExpress.XtraNavBar.NavBarDragDrop.None; LeftMenu[Top].Expanded = true; LeftMenu[Top].GroupClientHeight = 322; treeView1[Top].Dock = DockStyle.Fill; savetreeview = treeView1[Top]; if (savetop != -1 && itemcount == 0) { LeftMenu[savetop].Visible = false; } if (isSaveSubGroup == true && subitemcount == 0) { SaveSubGroupItems.Visible = false; } #endregion } else if (MenuType == 0) { #region [ navBarControl ] LeftMenu[Top] = navBarControl1.Groups.Add(); LeftMenu[Top].Caption = Caption; if (picname != "") { LeftMenu[Top].SmallImage = _core.Resource.GetImage(picname); } LeftMenu[Top].Name = controlname; if (savetop != -1 && itemcount == 0) { LeftMenu[savetop].Visible = false; } if (isSaveSubGroup == true && subitemcount == 0) { SaveSubGroupItems.Visible = false; } if (isSaveTreeSubGroup == true && subitemcount == 0) { savetreeview.Nodes.Remove(SaveRootNode); } if (fview == 0) { savefview = Top; } fview++; #endregion } savetop = Top; itemcount = 0; subitemcount = 0; isSaveSubGroup = false; isSaveTreeSubGroup = false; } else { //SubGroup if (MenuType == 1 || MenuType == 11) { if (MenuType == 11) { #region [ RootNodeSubGroup ] if (isSaveTreeSubGroup == true && subitemcount == 0) { savetreeview.Nodes.Remove(SaveRootNode); } if (isSaveSubGroup == true && subitemcount == 0) { SaveSubGroupItems.Visible = false; } TreeNode states1 = savetreeview.Nodes.Add(controlname, Caption, picname); states1.SelectedImageKey = picname; SaveRootNode = states1; isSaveTreeSubGroup = true; isSaveSubGroup = false; #endregion } else { #region [ TreeSubGroup ] if (isSaveTreeSubGroup == true && subitemcount == 0) { savetreeview.Nodes.Remove(SaveRootNode); } if (isSaveSubGroup == true && subitemcount == 0) { SaveSubGroupItems.Visible = false; } NavBarItem indexItem = navBarControl1.Items.Add(); indexItem.Caption = Caption; indexItem.Appearance.Font = font; indexItem.Name = controlname; LeftMenu[Top].ItemLinks.Add(indexItem); SaveSubGroupItems = indexItem; isSaveTreeSubGroup = false; isSaveSubGroup = true; #endregion } //Parameters subitemcount = 0; } else { //Item if (MenuType == 2 || MenuType == 12) { #region [ Items ] trancode = Static.ToLong(words[5]); if (_core.RemoteObject.GetTxn(trancode) == true) { picname = words[3]; StrPrivNo = words[5]; StrDll = words[6]; StrClass = words[7]; StrFunction = words[8]; StringBuilder sb = new StringBuilder(); sb.Clear(); sb.Append(controlname); sb.Append(";"); sb.Append(StrDll); sb.Append(";"); sb.Append(StrClass); sb.Append(";"); sb.Append(StrFunction); sb.Append(";"); sb.Append(StrPrivNo); mTxnArray[trancode] = new string[] { Static.ToStr(trancode), StrDll, StrClass, StrFunction }; Caption = Caption + " [" + Static.ToStr(trancode) + "]"; hashname.Add(trancode, Caption); if (MenuType == 12) { //TreeView il.Images.Add(picname, _core.Resource.GetImage(picname)); TreeNode states1 = SaveRootNode.Nodes.Add(controlname, Caption, picname); states1.Tag = sb.ToString(); states1.SelectedImageKey = picname; } else { //NavBarItem NavBarItem indexItem = navBarControl1.Items.Add(); indexItem.Caption = Caption; if (picname != "") { indexItem.SmallImage = _core.Resource.GetImage(picname); } indexItem.LinkClicked += new NavBarLinkEventHandler(indexItem_LinkClicked); indexItem.Name = controlname; indexItem.Tag = sb.ToString(); LeftMenu[Top].ItemLinks.Add(indexItem); } DTMenu.Rows.Add(trancode, Caption); //Param itemcount++; subitemcount++; } #endregion } #region [ Seperator ] else { //Seperator if (MenuType == 3) { NavBarItem indexItem = navBarControl1.Items.Add(); Caption = " "; indexItem.Caption = Caption; indexItem.Name = controlname; LeftMenu[Top].ItemLinks.Add(indexItem); } } #endregion } } index++; rowIndex = index; } #endregion file.Close(); navBarControl1.Visible = true; LeftMenu[savefview].Expanded = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }