From 50385e380396cbe5fd25832cbc0ada52b3a8476e Mon Sep 17 00:00:00 2001 From: lhiven <236881222@qq.com> Date: Thu, 11 Jan 2024 16:25:58 +0900 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E7=9A=84=E7=8A=B6=E6=80=81=E7=9A=84=E7=A9=B4=E4=BD=8D?= =?UTF-8?q?=E6=97=B6=E9=87=87=E7=94=A8=E5=8F=8D=E5=90=91=E6=9F=A5=E6=89=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.Controls/RsTray.cs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Rs.Controls/RsTray.cs b/Rs.Controls/RsTray.cs index c8d9510..89edcdc 100644 --- a/Rs.Controls/RsTray.cs +++ b/Rs.Controls/RsTray.cs @@ -98,16 +98,30 @@ namespace Rs.Controls set { _InitSlotStatus = value; InitSlot(InitSlotStatus); Invalidate(); } } - public TraySlot GetSlot(ESlotStatus status) + public TraySlot GetSlot(ESlotStatus status,bool reverse=false) { - foreach(KeyValuePair kv in traySlotsDic) + if(reverse) { - if (kv.Value.SlotStatus == status) - return kv.Value; + for (int row = 0; row < RowNum; row++) + { + for (int col = ColumnNum; col > 0; col--) + { + int index = row * (ColumnNum) + col; + if (traySlotsDic[index].SlotStatus == status) + return traySlotsDic[index]; + } + } + } + else + { + foreach (KeyValuePair kv in traySlotsDic) + { + if (kv.Value.SlotStatus == status) + return kv.Value; + } } return null; } - /// /// 通过穴位的索引获取穴位 ///