From 66e40679c38e0b03f97db6bab95277d3bd3d5221 Mon Sep 17 00:00:00 2001 From: lhiven Date: Sat, 23 Nov 2024 16:09:36 +0800 Subject: [PATCH] =?UTF-8?q?RsTray=E5=A2=9E=E5=8A=A0=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E6=96=B9=E5=90=91=E7=94=BB=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.Controls/RsTray.cs | 79 +++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/Rs.Controls/RsTray.cs b/Rs.Controls/RsTray.cs index 6f3a27a..34ca0bc 100644 --- a/Rs.Controls/RsTray.cs +++ b/Rs.Controls/RsTray.cs @@ -21,10 +21,30 @@ namespace Rs.Controls public enum ESortDir { + /// + /// 从左到右画 + /// LeftToRight, + /// + /// 从左上到左下画 + /// + LeftTopToBottom, + /// + /// 从左下到左上画 + /// + LeftBottomToTop, + /// + /// 从右向左画 + /// RightToLeft, + /// + /// 从右上到右下画 + /// RightTopToBottom, - LeftBottomToTop + /// + /// 从右下到右上画 + /// + RightBottomToTop } public enum ESlotStatus @@ -433,6 +453,46 @@ namespace Rs.Controls } } } + else if (sortDir == ESortDir.RightBottomToTop) + { + ShowColNumber = ShowRowNumber = false; + slotWidth = (this.panel2.Width) / ColumnNum; + slotHeight = (this.panel2.Height) / RowNum; + //从列开始画 + for (int c = ColumnNum; c >0; c--) + { + for (int r = RowNum; r > 0; r--) + { + index++; + if (traySlotsDic.ContainsKey(index)) + { + float x = slotWidth * (c-1); + float y = slotHeight * (r - 1); + traySlotsDic[index].Bound = new RectangleF(x, y, (int)slotWidth - ColSpace, (int)slotHeight - RowSpace); + } + } + } + } + else if (sortDir == ESortDir.LeftTopToBottom) + { + ShowColNumber = ShowRowNumber = false; + slotWidth = (this.panel2.Width) / ColumnNum; + slotHeight = (this.panel2.Height) / RowNum; + //从行开始画 + for (int c = 0; c < ColumnNum; c++) + { + for (int r = 0;r< RowNum; r++) + { + index++; + if (traySlotsDic.ContainsKey(index)) + { + float x = slotWidth * c; + float y = slotHeight * (r); + traySlotsDic[index].Bound = new RectangleF(x, y, (int)slotWidth - ColSpace, (int)slotHeight - RowSpace); + } + } + } + } else if (sortDir == ESortDir.LeftBottomToTop) { ShowColNumber = ShowRowNumber = false; @@ -450,23 +510,6 @@ namespace Rs.Controls float y = slotHeight * (r-1); traySlotsDic[index].Bound = new RectangleF(x, y, (int)slotWidth - ColSpace, (int)slotHeight - RowSpace); } - - - //index++; - //if (traySlotsDic.ContainsKey(index)) - //{ - // float y = 0; - // float x = LeftSpaceWidth + slotWidth * r; - // if(!ShowColNumber) - // { - // y = slotHeight * c - TopSpaceHeight / 2; - // } - // else - // { - // y = slotHeight * c; - // } - // traySlotsDic[index].Bound = new RectangleF(x, y, (int)slotWidth - ColSpace, (int)slotHeight - RowSpace); - //} } } }