📄 sshowcenter.cpp
字号:
CDC *pDC = GetDC();
ReleaseDC(pDC);
DisplayMode = VIDEO_MULTI_CHANNEL;
}
}
CWnd::OnLButtonDblClk(nFlags, point);
}
//----------------------------------------------------------------------------------//
int CSshowCenter::GetSelect(CPoint point)
{
for(int i =0; i < 64; i++)
{
if(m_bDisplay)
{
if(PtInRect(&rectList[i], point))//anomalyrect
{
return i;
}
}
else
if(PtInRect(&anomalyrect[i], point))//anomalyrect
{
return i;
}
}
return -1;
}
//---在这里判当前鼠标坐标点在哪一个通道里
int CSshowCenter::GetSelIndex(int x, int y)
{
CRect rect;
rect = m_rcWnd;
rect.right = m_rcWnd.right-2;
rect.bottom = m_rcWnd.bottom -2;
int RowSpacing, ColWidth;
RowSpacing = (rect.Height())/m_iRows;//---
ColWidth = (rect.Width())/m_iCols;//---
int i, index;
i = y * m_iRows / (rect.Height());
index = i * m_iCols;
i = x * m_iCols / (rect.Width());
index = index + i;
return index;
}
//在这里设置点击红色框架的坐标
//传下来的index代表是几号通道
CRect CSshowCenter::GetSelRect(int index)
{
CRect rect,result;
rect = m_rcWnd;
rect.right = m_rcWnd.right - 4;
rect.bottom = m_rcWnd.bottom - 4 ;
int RowSpacing, ColWidth;
RowSpacing = (rect.Height()) / m_iRows;
ColWidth = (rect.Width()) / m_iCols;
int i;
i = ((index) / m_iCols);
//红线框架整体向下置放
//result获得了当前通道的坐标点并且返回
result.top = rect.top + i * (rect.Height()) / m_iRows ;
result.bottom = result.top + (rect.Height()) / m_iRows;
i = ((index)%m_iCols);
//红线框架整体向左置放
result.left = rect.left + i*(rect.Width()) / m_iCols;
result.right = result.left + (rect.Width()) / m_iCols;
return result;
}
//---
void CSshowCenter::SetRowsCols(int rows, int cols,int nSplitCount1)
{
m_iCols = cols;
m_iRows = rows;
nSplitCount = nSplitCount1;
}
//---------------
//--在这里设置获取到的屏幕的大小
int SplitRects(int width, int height, int cols, int rows, RECT *rectList)
{
int numRects = cols * rows;//加此条件为以下判断做准备。屏幕将分为numRects块
int inCols, inRows;
int subRectH = height / rows;
int subRectW = width / cols;
ASSERT((cols >= 1) && (rows >= 1));//算是一个报错的信息!
//---设置通道屏幕大小的坐标
for(int i = 0; i < numRects; i++)//屏幕为numRects块
{
inRows = i / cols;
inCols = i % cols;//取余的意思!
rectList[i].left = inCols * subRectW + 5;
rectList[i].top = inRows * subRectH + 5;
rectList[i].right = rectList[i].left + subRectW - 10;
rectList[i].bottom = rectList[i].top + subRectH - 10;
}
return numRects;
}
//---------------
int CSshowCenter::CacRects(int numRects)
{
RECT r;
GetClientRect(&r);
int rectWidth = r.right - r.left;
int rectHeight = r.bottom - r.top;
switch(numRects)
{
case 1:
numRects = SplitRects(rectWidth, rectHeight, 1, 1, rectList);
break;
case 2:
case 3:
case 4:
numRects = SplitRects(rectWidth, rectHeight, 2, 2, rectList);
break;
case 5:
case 6:
case 7:
case 8:
case 9:
numRects = SplitRects(rectWidth, rectHeight, 3, 3, rectList);
break;
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
numRects = SplitRects(rectWidth, rectHeight, 4, 4, rectList);
break;
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
numRects = SplitRects(rectWidth, rectHeight, 5, 5, rectList);
break;
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 36:
numRects = SplitRects(rectWidth, rectHeight, 6, 6, rectList);
break;
case 37:
case 38:
case 39:
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
case 48:
case 49:
numRects = SplitRects(rectWidth, rectHeight, 7, 7, rectList);
break;
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
case 64:
numRects = SplitRects(rectWidth, rectHeight, 8, 8, rectList);
break;
default:
numRects = SplitRects(rectWidth, rectHeight, 5 , 5, rectList);
break;
}
return numRects;
}
//---
void CSshowCenter::SelectRect(int i, CDC *dc)
{
if((i == -1) ||(DisplayMode != VIDEO_MULTI_CHANNEL))return;
iLastSelect = i;
return;
}
void CSshowCenter::VideoCoorDinate(int num,int rectWidth,int rectHeight)
{
switch(num)
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
//---
case 5:
//--7P
ZeroMemory(rectList, sizeof(rectList));
rectlist[0].left = 5;
rectlist[0].top = 5;
rectlist[0].right = rectWidth/2 - 5;
rectlist[0].bottom = rectHeight/2 - 5;
rectlist[1].left= 6;
rectlist[1].top=rectHeight/2 + 6;
rectlist[1].right=rectWidth/2 - 6;
rectlist[1].bottom=rectHeight - 7;
rectlist[2].left=rectWidth/2 + 6;
rectlist[2].top=rectHeight/2 + 6;
rectlist[2].right=rectWidth - 7;
rectlist[2].bottom=rectHeight - 7;
//---------------------------------------------------------
rectlist[3].left=rectWidth/2+6;
rectlist[3].top=6;
rectlist[3].right=rectWidth/2+rectWidth/4 - 5;
rectlist[3].bottom=rectHeight/4 - 5;
rectlist[4].left=rectWidth/2+1;
rectlist[4].top=rectHeight/4+1 ;
rectlist[4].right=rectWidth/2+rectWidth/4;
rectlist[4].bottom=rectHeight/2;
rectlist[5].left=rectWidth/2+rectWidth/4;
rectlist[5].top=rectHeight/4 ;
rectlist[5].right=rectWidth;
rectlist[5].bottom=rectHeight/2;
rectlist[6].left=rectWidth/2+rectWidth/4;
rectlist[6].top=0 ;
rectlist[6].right=rectWidth;
rectlist[6].bottom=rectHeight/4;
DistrictCoorDinate(num, rectWidth,rectHeight);
break;
case 6://---10p
ZeroMemory(rectlist, sizeof(rectlist));
rectlist[0].left= 6;
rectlist[0].top= 6;
rectlist[0].right=rectWidth/2 - 6;
rectlist[0].bottom=rectHeight/2 - 6;
rectlist[1].left=5;
rectlist[1].top=rectHeight/2+6;
rectlist[1].right=rectWidth/4 - 5;
rectlist[1].bottom=rectHeight/2+rectHeight/4 - 5;
rectlist[2].left=5;
rectlist[2].top=rectHeight/2+rectHeight/4 + 5;
rectlist[2].right=rectWidth/4 - 5;
rectlist[2].bottom=rectHeight - 6;
//---------------------------------------------------------
rectlist[3].left=rectWidth/4 + 5;
rectlist[3].top=rectHeight/2+1 + 5;
rectlist[3].right=rectWidth/2 -5;
rectlist[3].bottom=rectHeight/2+rectHeight/4 - 5;
rectlist[4].left=rectWidth/4;
rectlist[4].top=rectHeight/2+rectHeight/4 ;
rectlist[4].right=rectWidth/2;
rectlist[4].bottom=rectHeight;
rectlist[5].left=rectWidth/2;
rectlist[5].top=rectHeight/2 ;
rectlist[5].right=rectWidth/2+rectWidth/4;
rectlist[5].bottom=rectHeight/2+rectHeight/4;
rectlist[6].left=rectWidth/2;
rectlist[6].top=rectHeight/2+rectHeight/4 ;
rectlist[6].right=rectWidth/2+rectWidth/4;
rectlist[6].bottom=rectHeight;
rectlist[7].left=rectWidth/2+rectWidth/4;
rectlist[7].top=rectHeight/2 ;
rectlist[7].right=rectWidth;
rectlist[7].bottom=rectHeight/2+rectHeight/4;
rectlist[8].left=rectWidth/2+rectWidth/4;
rectlist[8].top=rectHeight/2+rectHeight/4 ;
rectlist[8].right=rectWidth;
rectlist[8].bottom=rectHeight;
rectlist[9].left=rectWidth/2;
rectlist[9].top=0 ;
rectlist[9].right=rectWidth;
rectlist[9].bottom=rectHeight/2;
DistrictCoorDinate(num, rectWidth,rectHeight);
break;
case 7:
break;
case 8://---8p
ZeroMemory(rectlist, sizeof(rectlist));
rectlist[0].left=6;
rectlist[0].top= 6;
rectlist[0].right=rectWidth/2+rectWidth/4 - 5;
rectlist[0].bottom=rectHeight/2+rectHeight/4 - 5;
rectlist[1].left=6;
rectlist[1].top=rectHeight/2+rectHeight/4 + 6;
rectlist[1].right=rectWidth/4 - 5;
rectlist[1].bottom=rectHeight - 7;
rectlist[2].left=rectWidth/4 + 6;
rectlist[2].top=rectHeight/2+rectHeight/4 + 6;
rectlist[2].right=rectWidth/2 - 5;
rectlist[2].bottom=rectHeight - 7;
//---------------------------------------------------------
rectlist[3].left=rectWidth/2 + 6;
rectlist[3].top=rectHeight/2+rectHeight/4 + 6;
rectlist[3].right=rectWidth/2+rectWidth/4 - 5;
rectlist[3].bottom=rectWidth - 157;
rectlist[4].left=rectWidth/2+rectWidth/4;
rectlist[4].top=rectHeight/2+rectHeight/4 ;
rectlist[4].right=rectWidth;
rectlist[4].bottom=rectHeight;
rectlist[5].left=rectWidth/2+rectWidth/4;
rectlist[5].top=0 ;
rectlist[5].right=rectWidth;
rectlist[5].bottom=rectHeight/4;
rectlist[6].left=rectWidth/2+rectWidth/4;
rectlist[6].top=rectHeight/4 ;
rectlist[6].right=rectWidth;
rectlist[6].bottom=rectHeight/2;
rectlist[7].left=rectWidth/2+rectWidth/4;
rectlist[7].top=rectHeight/2 ;
rectlist[7].right=rectWidth;
rectlist[7].bottom=rectHeight/2+rectHeight/4 ;
DistrictCoorDinate(num, rectWidth,rectHeight);
break;
case 9://---6p
ZeroMemory(rectlist, sizeof(rectlist));
rectlist[0].left=6;
rectlist[0].top=6;
rectlist[0].right=rectWidth/3 + rectWidth/3 - 6;
rectlist[0].bottom=rectHeight/3 + rectHeight/3 - 6;
rectlist[1].left= 5;
rectlist[1].top=rectHeight/3 + rectHeight/3 + 5;
rectlist[1].right=rectWidth/3 - 8;
rectlist[1].bottom=rectHeight - 8;
rectlist[2].left = rectWidth/3 + 5;
rectlist[2].top = rectHeight/3 + rectHeight/3 + 5;
rectlist[2].right = rectHeight/3 + rectHeight/2 - 8;
rectlist[2].bottom = rectHeight - 8;
//---------------------------------------------------------
rectlist[3].left = rectHeight/3 + rectHeight/2 + 5;
rectlist[3].top = rectHeight/3 + rectHeight/3 + 5;
rectlist[3].right=rectWidth - 8;
rectlist[3].bottom=rectHeight - 8;
rectlist[4].left = rectWidth/3 + rectWidth/3;
rectlist[4].top = 0;
rectlist[4].right=rectWidth - 3;
rectlist[4].bottom=rectHeight/3;
rectlist[5].left = rectWidth/3 + rectWidth/3;
rectlist[5].top=rectHeight/3;
rectlist[5].right=rectWidth - 3;
rectlist[5].bottom=rectHeight/3 + rectHeight/3;
DistrictCoorDinate(num, rectWidth,rectHeight);
break;
case 10://---13p
ZeroMemory(rectlist, sizeof(rectlist));
rectlist[0].left=6;
rectlist[0].top=6;
rectlist[0].right=rectWidth/4 - 5;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -