实现了简单的监控视屏分屏浏览技术
///
/// 计算视频面板位置和面积
///
///
/// 总面积和坐标
///
private IList CalcPanelRectangle(int channelCount, Size TotalArea)
{
IList result = new List();
//模数
int modulo;
if (channelCount 64)
modulo = 8;
else
modulo = (int)Math.Ceiling(Math.Sqrt(channelCount)); //平方根
int width, height;
//单个画面大小
width = (TotalArea.Width - modulo * 1) / modulo;
height = (TotalArea.Height - modulo * 1) / modulo;
for (int i = 0; i < channelCount; i++)
{
Rectangle rect = new Rectangle();
//AxDICOMax.AxDICOMX rect = new AxDICOMax.AxDICOMX();
rect.Width = width;
rect.Height = height;
if (i % modulo == 0)
{
rect.X = 1;
if (i == 0)
rect.Y = 1;
else
rect.Y = result[i - modulo].Y + height + 1;
}
else
{
rect.X = result[i - 1].X + width + 1;
rect.Y = result[i - 1].Y;
}
result.Add(rect);
}
return result;
}
1