From 2f7e917dc9032961335d506a689bfd30c709ba9e Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期四, 03 四月 2025 11:01:52 +0800
Subject: [PATCH] 字典
---
DevApp/Gs.DevApp/XtraForm1.cs | 79 +++++++++++++++++----------------------
1 files changed, 35 insertions(+), 44 deletions(-)
diff --git a/DevApp/Gs.DevApp/XtraForm1.cs b/DevApp/Gs.DevApp/XtraForm1.cs
index a31ec54..49e5a3e 100644
--- a/DevApp/Gs.DevApp/XtraForm1.cs
+++ b/DevApp/Gs.DevApp/XtraForm1.cs
@@ -20,69 +20,29 @@
public XtraForm1()
{
InitializeComponent();
- tlMenu.CustomDrawNodeCheckBox += TreeList1_CustomDrawNodeCheckBox;
+ tlMenu.ContextMenuStrip = contextMenuStrip1;
getTree();
-
- // 鍒濆鍖朤reeList
-
- //tlMenu.BestFitColumns();
- //tlMenu.EndInit();
-
- //// 璁剧疆澶嶉�夋鏄剧ず妯″紡
- //tlMenu.OptionsBehavior.Editable = true;
- //this.tlMenu.OptionsView.ShowCheckBoxes = true;
- //tlMenu.OptionsSelection.MultiSelect = true;
- ////tlMenu.OptionsSelection.MultiSelectMode = TreeListMultiSelectMode.;
-
- // 娣诲姞GetShowCheckBox浜嬩欢澶勭悊鍣�
-
- tlMenu.OptionsBehavior.Editable = true;
- tlMenu.OptionsSelection.EnableAppearanceFocusedCell = false;
- tlMenu.OptionsSelection.MultiSelect = true;
- tlMenu.OptionsSelection.MultiSelectMode = TreeListMultiSelectMode.CellSelect;
- // this.tlMenu.GetChildAtPoint += new DevExpress.XtraTreeList.GetChildNodeCheckBoxEventHandler(this.treeList_GetChildNodeCheckBox)
- }
- private void TreeList1_CustomDrawNodeCheckBox(object sender, DevExpress.XtraTreeList.CustomDrawNodeCheckBoxEventArgs e)
- {
- // 鍒ゆ柇褰撳墠鑺傜偣鏄惁涓哄彾瀛愯妭鐐癸紙鏃犲瓙鑺傜偣锛�
- if (e.Node.Nodes.Count == 0)
- {
- // 鍏佽缁樺埗澶嶉�夋锛堥粯璁よ涓猴級
- }
- else
- {
- // 鍙栨秷缁樺埗澶嶉�夋
- e.Handled = true;
- }
}
- // 鍙�夛細澶勭悊鑺傜偣灞曞紑浜嬩欢锛岀‘淇濆姩鎬佸姞杞界殑瀛愯妭鐐圭敓鏁�
- private void treeList1_BeforeExpand(object sender, BeforeExpandEventArgs e)
- {
- // 鑻ュ瓙鑺傜偣鏄姩鎬佸姞杞界殑锛屽湪姝ゅ鍔犺浇鏁版嵁
- // LoadChildNodes(e.Node);
- }
/// <summary>
/// 璇诲彇鍒楄〃
/// </summary>
private void getTree()
{
- var pgq = new PageQueryModel(1, 999999, "a.idx");
+ var pgq = new PageQueryModel(1, 999999, "a.type_memo");
var json = JsonConvert.SerializeObject(pgq);
try
{
var strReturn =
- UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
+ UtilityHelper.HttpPost("", "MesDefectTypeManager/GetListPage", json);
var dd = UtilityHelper.ReturnToTablePage(strReturn);
var dt = dd.rtnData.list;
tlMenu.DataSource = dt;
tlMenu.KeyFieldName = "guid";
tlMenu.ParentFieldName = "upGuid";
- tlMenu.Tag = "name";
+ tlMenu.Tag = "typeMemo";
tlMenu.EndUpdate();
this.tlMenu.CollapseAll();
-
-
tlMenu.OptionsBehavior.Editable = true;
tlMenu.OptionsBehavior.AllowRecursiveNodeChecking = false;
}
@@ -91,5 +51,36 @@
MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
}
}
+
+ private void tlMenu_MouseDown(object sender, MouseEventArgs e)
+ {
+ if (e.Button == MouseButtons.Right)
+ {
+ var hitInfo = tlMenu.CalcHitInfo(new Point(e.X, e.Y));
+ if (hitInfo.HitInfoType == HitInfoType.Cell)
+ {
+ tlMenu.FocusedNode = hitInfo.Node;
+ contextMenuStrip1.Show(tlMenu, e.Location);
+ }
+ }
+ }
+
+ private void toolStripMenuItem1_Click(object sender, EventArgs e)
+ {
+ if (tlMenu.FocusedNode != null)
+ {
+ // 鍒犻櫎鑺傜偣鐨勯�昏緫
+ tlMenu.DeleteNode(tlMenu.FocusedNode);
+ }
+ }
+
+ private void toolStripMenuItem2_Click(object sender, EventArgs e)
+ {
+ if (tlMenu.FocusedNode != null)
+ {
+ // 淇敼鑺傜偣鐨勯�昏緫锛屼緥濡傛洿鏀硅妭鐐瑰��
+ tlMenu.FocusedNode.SetValue("鍒楀悕", "鏂板��"); // 鏇挎崲"鍒楀悕"鍜�"鏂板��"涓哄疄闄呭垪鍚嶅拰鍊�
+ }
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.3