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; } - /// /// 通过穴位的索引获取穴位 ///