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); } }