From 4bc7030c4cea5b3deed0c938ec388ae94e33c51c Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 25 十月 2024 09:42:36 +0800 Subject: [PATCH] 修改会页 --- DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs | 74 ++++++++++++++++++++++--------------- 1 files changed, 44 insertions(+), 30 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs b/DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs index faa80f1..bb90c0c 100644 --- a/DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs +++ b/DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs @@ -1,13 +1,14 @@ -锘縰sing DevExpress.XtraEditors.Controls; -using DevExpress.XtraTreeList; -using DevExpress.XtraTreeList.Nodes; +锘縰sing DevExpress.XtraEditors; +using DevExpress.XtraEditors.Controls; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; +using System.Drawing; using System.Reflection; +using System.Resources; using System.Windows.Forms; namespace Gs.DevApp.DevFrm.User @@ -17,8 +18,8 @@ public SysMenu() { InitializeComponent(); + getImg(); txt_upGuid.Properties.PopupFormSize = new System.Drawing.Size(txt_upGuid.Width, 300); - //txt_upGuid.Properties.ImmediatePopup = true; txt_upGuid.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick; this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; @@ -68,7 +69,6 @@ this.txt_formPath.Enabled = false; this.txt_icon.Enabled = false; this.txt_formPath.Text = ""; - this.txt_icon.Text = ""; } } /// <summary> @@ -78,16 +78,9 @@ /// <param name="e"></param> private void TlMenu_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e) { - TreeListHitInfo info = tlMenu.CalcHitInfo(e.Location); - if (info.Node != null) - { - TreeListNode clickedNode = this.tlMenu.FocusedNode; - if (clickedNode.FirstNode == null) - { - string rowGuid = clickedNode.GetValue("guid").ToString(); - getModel(rowGuid, false, 999); - } - } + string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(tlMenu, e, "guid"); + if (!string.IsNullOrEmpty(rowGuid)) + getModel(rowGuid, false, 999); } /// <summary> /// 鍙栨秷浜嬩欢 @@ -117,15 +110,18 @@ { return; } - var _obj = new - { - guid = rowGuid,//涓诲缓 - }; + List<string> lst = new List<string>(); + lst.Add(rowGuid); + var _obj = lst; try { string strJson = UtilityHelper.HttpPost("", "MenuAction/DeleteModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) { getTree(); } + if (_rtn.rtnCode > 0) + { + UtilityHelper.JumpToTab(xtraTabControl1, 0); + getTree(); + } ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) @@ -201,17 +197,11 @@ txt_name.Focus(); return; } - if (string.IsNullOrEmpty(txt_isStatus.Text.Trim()) || txt_isStatus.SelectedIndex == 0) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟鐘舵�佷笉鑳戒负绌猴紒"); - txt_isStatus.Focus(); - return; - } string _upGuid = txt_upGuid.EditValue.ToString(); if (txt_category.SelectedIndex == 2 && string.IsNullOrEmpty(_upGuid)) { Gs.DevApp.ToolBox.MsgHelper.Warning("鎸夐挳绫诲瀷蹇呴』閫夋嫨鐖剁骇鑿滃崟锛�"); - txt_isStatus.Focus(); + txt_upGuid.Focus(); return; } var _obj = new @@ -220,7 +210,7 @@ upGuid = _upGuid,//涓婄骇鐨勪富寤� name = txt_name.Text.Trim(),//鍚嶇О icon = txt_icon.Text,//鑿滃崟鍥炬爣 - isStatus = txt_isStatus.SelectedIndex,//鐘舵�� + isStatus = txt_isStatus.Checked,//鐘舵�� formPath = txt_formPath.Text.Trim(),//绐椾綋璺緞 idx = int.Parse(txt_idx.Value.ToString()),//鎺掑簭 category = txt_category.SelectedIndex,//绫诲瀷 @@ -260,7 +250,7 @@ this.tlMenu.ParentFieldName = "upGuid"; this.tlMenu.Tag = "name"; this.tlMenu.EndUpdate(); - this.tlMenu.ExpandAll(); + // this.tlMenu.ExpandAll(); tlMenu.OptionsView.CheckBoxStyle = DevExpress.XtraTreeList.DefaultNodeCheckBoxStyle.Default; } catch (Exception ex) @@ -338,6 +328,30 @@ } } } - + + private void getImg() + { + Assembly assembly = Assembly.GetExecutingAssembly(); + ResourceManager resourceManager = new ResourceManager("Gs.DevApp.Properties.Resources", assembly); + int i = 0; + DevExpress.Utils.ImageCollection dicImg = new DevExpress.Utils.ImageCollection(); + Properties.Resources res = new Properties.Resources(); + PropertyInfo[] properInfo = res.GetType().GetProperties(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance); + foreach (PropertyInfo item in properInfo) + { + if (item.Name.Contains("_")) + { + Image image = resourceManager.GetObject(item.Name) as Image; + if (image != null) + { + dicImg.AddImage(image); + txt_icon.Properties.Items.Add(new DevExpress.XtraEditors.Controls.ImageComboBoxItem(item.Name, i, i)); + i++; + } + } + } + txt_icon.Properties.LargeImages = dicImg; + txt_icon.Properties.SmallImages = dicImg; + } } } \ No newline at end of file -- Gitblit v1.9.3