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