From 4cb1479669f8f7c587b3c13b5f54d87e8dde44ca Mon Sep 17 00:00:00 2001 From: lhiven <236881222@qq.com> Date: Sat, 4 Nov 2023 15:43:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BD=93=E7=A9=B4=E4=BD=8D?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BANull=E6=97=B6=EF=BC=8C=E5=8F=B3?= =?UTF-8?q?=E4=B8=8B=E8=BE=B9=E6=A1=86=E4=B8=8D=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.Controls/RsTray.cs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Rs.Controls/RsTray.cs b/Rs.Controls/RsTray.cs index d864708..a9233bb 100644 --- a/Rs.Controls/RsTray.cs +++ b/Rs.Controls/RsTray.cs @@ -28,7 +28,8 @@ namespace Rs.Controls NotHave, Ok, Ng, - Disable + Disable, + Null } public partial class RsTray : UserControl @@ -271,6 +272,14 @@ namespace Rs.Controls } } + public void ChangeStatus(ESlotStatus status) + { + foreach (KeyValuePair kv in traySlotsDic) + { + ChangeStatus(kv.Value.Index,status); + } + } + public void ChangeStatus(int index, ESlotStatus status) { if (traySlotsDic.ContainsKey(index)) @@ -534,13 +543,23 @@ namespace Rs.Controls case ESlotStatus.Disable: g.FillRectangle(new SolidBrush(Color.Gray), Bound.X, Bound.Y, Bound.Width - 1, Bound.Height - 1); break; + case ESlotStatus.Null: + g.FillRectangle(new SolidBrush(Color.FromArgb(11, 16, 36)), Bound.X, Bound.Y, Bound.Width - 1, Bound.Height - 1); + break; default: break; } - g.DrawRectangle(Pens.White, Bound.X, Bound.Y, Bound.Width, Bound.Height); - if (isShowText) + if(SlotStatus!= ESlotStatus.Null) + { + g.DrawRectangle(Pens.White, Bound.X, Bound.Y, Bound.Width, Bound.Height); + if (isShowText) + { + g.DrawString(Index.ToString(), new Font("宋体", 8), new SolidBrush(Color.Yellow), _Bound, sf); + } + } + else { - g.DrawString(Index.ToString(), new Font("宋体", 8), new SolidBrush(Color.Yellow), _Bound, sf); + g.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(11, 16, 36))), Bound.X, Bound.Y, Bound.Width, Bound.Height); } } }