料盘方向增加左下到左上和右上到右下

master
lhiven 10 months ago
parent 5f82890823
commit 51b1b1b3d5

@ -22,7 +22,9 @@ namespace Rs.Controls
public enum ESortDir
{
LeftToRight,
RightToLeft
RightToLeft,
RightTopToBottom,
LeftBottomToTop
}
public enum ESlotStatus
@ -95,6 +97,27 @@ namespace Rs.Controls
}
}
private bool _ShowRowNumber;
/// <summary>
/// 是否显示行号
/// </summary>
public bool ShowRowNumber
{
get { return _ShowRowNumber; }
set { _ShowRowNumber = value; }
}
private bool _ShowColNumber;
/// <summary>
/// 是否显示列号
/// </summary>
public bool ShowColNumber
{
get { return _ShowColNumber; }
set { _ShowColNumber = value; }
}
public RsTray()
{
InitializeComponent();
@ -184,7 +207,7 @@ namespace Rs.Controls
set { _HeadText = value; this.label1.Text = value; }
}
private int _RowNum = 26;
private int _RowNum = 16;
/// <summary>
/// 行数
@ -195,7 +218,7 @@ namespace Rs.Controls
set { _RowNum = value; InitSlot(InitSlotStatus); Invalidate(); }
}
private int _ColumnNum = 10;
private int _ColumnNum = 16;
/// <summary>
/// 列数量
@ -387,6 +410,48 @@ namespace Rs.Controls
}
}
}
else if (sortDir == ESortDir.RightTopToBottom)
{
//从列开始画
for (int r = RowNum; r > 0; r--)
{
for (int c = 0; c < ColumnNum; c++)
{
index++;
if (traySlotsDic.ContainsKey(index))
{
float x = slotWidth * r;
float y = slotHeight * c;
traySlotsDic[index].Bound = new RectangleF(x, y, (int)slotWidth - ColSpace, (int)slotHeight - RowSpace);
}
}
}
}
else if (sortDir == ESortDir.LeftBottomToTop)
{
//从列开始画
for (int r = 0; r < RowNum; r++)
{
for (int c = ColumnNum; c > 0; c--)
{
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);
}
}
}
}
panel2.Refresh();
}
@ -409,6 +474,8 @@ namespace Rs.Controls
{
index++;
if (r == 0)
{
if(ShowRowNumber)
{
//画料盘的列号
if (SortDir == ESortDir.LeftToRight)
@ -419,12 +486,21 @@ namespace Rs.Controls
{
g2.DrawString((ColumnNum - c).ToString(), new Font("宋体", 7.0F), new SolidBrush(Color.White), new PointF(LeftSpaceWidth + (widthPer * c) + 5, 5));
}
else if (SortDir == ESortDir.LeftBottomToTop)
{
//g2.DrawString((ColumnNum - c).ToString(), new Font("宋体", 7.0F), new SolidBrush(Color.White), new PointF(LeftSpaceWidth + (widthPer * c) + 5, 5));
}
}
}
if (c == 0)
{
if(ShowColNumber)
{
//画料盘的行号
g2.DrawString((r + 1).ToString(), new Font("宋体", 7.0F), new SolidBrush(Color.White), new PointF(5, TopSpaceHeight + (heightPer * r)));
}
}
if (traySlotsDic.ContainsKey(index))
{
traySlotsDic[index].Draw(g2, ShowText);

Loading…
Cancel
Save