From a49e06e08f67c6b962148b0b5792fb9d2733eb12 Mon Sep 17 00:00:00 2001 From: lhiven <236881222@qq.com> Date: Thu, 29 Feb 2024 08:01:26 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E7=94=BB=E7=9B=98?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E5=9B=9E=E8=B0=83=E4=BA=8B=E4=BB=B6=202?= =?UTF-8?q?=E3=80=81=E5=BD=93=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=B7=A6=E8=BE=B9=E5=A4=B8=E4=B8=A4=E5=88=97?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.Controls/RsTray.cs | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/Rs.Controls/RsTray.cs b/Rs.Controls/RsTray.cs index 89edcdc..19fc00f 100644 --- a/Rs.Controls/RsTray.cs +++ b/Rs.Controls/RsTray.cs @@ -12,6 +12,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Xml.Serialization; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Rs.Controls { @@ -34,6 +35,7 @@ namespace Rs.Controls public partial class RsTray : UserControl { + public event Action> DrawTrayAfterEvent; public string ItemName { get; set; } private ESortDir sortDir = ESortDir.LeftToRight; @@ -59,6 +61,10 @@ namespace Rs.Controls get { return mShowStatus; } set { mShowStatus = value; lblStatus.Visible = mShowStatus; + if(!mShowStatus) + { + tableLayoutPanel1.SetColumnSpan(label1, 2); + } } } #endregion @@ -122,6 +128,22 @@ namespace Rs.Controls } return null; } + + /// + /// 根据穴位的状态获取穴位 + /// + /// + /// + public List GetSlots(ESlotStatus status) + { + List slots = new List(); + foreach (KeyValuePair item in traySlotsDic) + { + if (item.Value.SlotStatus == status) + slots.Add(item.Value); + } + return slots; + } /// /// 通过穴位的索引获取穴位 /// @@ -471,6 +493,15 @@ namespace Rs.Controls private void 禁用ToolStripMenuItem_Click(object sender, EventArgs e) { ChangeSlotStatus(ESlotStatus.Disable); + List slots = new List(); + foreach (KeyValuePair kvSlot in traySlotsDic) + { + if (drawRect.IntersectsWith(kvSlot.Value.Bound)) + { + slots.Add(kvSlot.Value); + } + } + DrawTrayAfterEvent?.Invoke(this, ESlotStatus.Disable, slots); } private void ChangeSlotStatus(ESlotStatus status) @@ -488,11 +519,29 @@ namespace Rs.Controls private void 设置有料ToolStripMenuItem_Click(object sender, EventArgs e) { ChangeSlotStatus(ESlotStatus.Have); + List slots = new List(); + foreach (KeyValuePair kvSlot in traySlotsDic) + { + if (drawRect.IntersectsWith(kvSlot.Value.Bound)) + { + slots.Add(kvSlot.Value); + } + } + DrawTrayAfterEvent?.Invoke(this, ESlotStatus.Have,slots); } private void 设置无料ToolStripMenuItem_Click(object sender, EventArgs e) { ChangeSlotStatus(ESlotStatus.NotHave); + List slots = new List(); + foreach (KeyValuePair kvSlot in traySlotsDic) + { + if (drawRect.IntersectsWith(kvSlot.Value.Bound)) + { + slots.Add(kvSlot.Value); + } + } + DrawTrayAfterEvent?.Invoke(this, ESlotStatus.NotHave,slots); } }