RsTray增加其他方向画盘

master
lhiven 5 months ago
parent 17d22a1608
commit 66e40679c3

@ -21,10 +21,30 @@ namespace Rs.Controls
public enum ESortDir public enum ESortDir
{ {
/// <summary>
/// 从左到右画
/// </summary>
LeftToRight, LeftToRight,
/// <summary>
/// 从左上到左下画
/// </summary>
LeftTopToBottom,
/// <summary>
/// 从左下到左上画
/// </summary>
LeftBottomToTop,
/// <summary>
/// 从右向左画
/// </summary>
RightToLeft, RightToLeft,
/// <summary>
/// 从右上到右下画
/// </summary>
RightTopToBottom, RightTopToBottom,
LeftBottomToTop /// <summary>
/// 从右下到右上画
/// </summary>
RightBottomToTop
} }
public enum ESlotStatus 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) else if (sortDir == ESortDir.LeftBottomToTop)
{ {
ShowColNumber = ShowRowNumber = false; ShowColNumber = ShowRowNumber = false;
@ -450,23 +510,6 @@ namespace Rs.Controls
float y = slotHeight * (r-1); float y = slotHeight * (r-1);
traySlotsDic[index].Bound = new RectangleF(x, y, (int)slotWidth - ColSpace, (int)slotHeight - RowSpace); 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);
//}
} }
} }
} }

Loading…
Cancel
Save