⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sshowcenter.cpp

📁 此代码使用bmp图作为主要界面
💻 CPP
📖 第 1 页 / 共 4 页
字号:
		rect.bottom = m_rcWnd.bottom -2;
		
		CBrush* oldbrush;
		oldbrush=(CBrush *)m_BackgroundDC.SelectStockObject(NULL_BRUSH);
		m_BackgroundDC.Rectangle(rect);
		m_BackgroundDC.SelectObject(oldbrush);
		
		int RowSpacing, ColWidth;  
		RowSpacing = (rect.Height())/m_iRows;
		ColWidth = (rect.Width())/m_iCols;
		
		int j;
		//---画线从	MoveTo开始移动,终点LineTo!
		for (j=0; j<m_iRows; j++)
		{
			m_BackgroundDC.MoveTo(rect.left, rect.top + j*(rect.Height())/m_iRows);
			m_BackgroundDC.LineTo(rect.right, rect.top + j*(rect.Height())/m_iRows);
		}
		for (j=0; j<m_iCols; j++)
		{
			m_BackgroundDC.MoveTo(rect.left + j*(rect.Width())/m_iCols, rect.top);
			m_BackgroundDC.LineTo(rect.left + j*(rect.Width())/m_iCols, rect.bottom);
		}
		
		m_BackgroundDC.SelectObject(pOldPen);	
		GetDC()->BitBlt(0, 0, m_rcWnd.Width(), m_rcWnd.Height(), &m_BackgroundDC , 0, 0, SRCCOPY);
		//--------------------------
		str.Format(strArray1[i]);
		
		dc->SetTextColor(RGB(255,0,0));
		dc->SetBkMode(TRANSPARENT);	
		dc->TextOut(rectList[i].left+5,rectList[i].top+10,str);
	}	
}

void CSshowCenter::DistrictCoorDinate(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
		anomalyrect[0].left = 0;
		anomalyrect[0].top = 0;
		anomalyrect[0].right = rectWidth/2;
		anomalyrect[0].bottom = rectHeight/2;
		
		anomalyrect[1].left= 0;
		anomalyrect[1].top=rectHeight/2; 
		anomalyrect[1].right=rectWidth/2;
		anomalyrect[1].bottom=rectHeight - 3;
		
		anomalyrect[2].left=rectWidth/2;
		anomalyrect[2].top=rectHeight/2;
		anomalyrect[2].right=rectWidth - 3;
		anomalyrect[2].bottom=rectHeight - 3;
		
		//---------------------------------------------------------
		anomalyrect[3].left=rectWidth/2 - 1;
		anomalyrect[3].top=2 - 2;
		anomalyrect[3].right=rectWidth/2+rectWidth/4;
		anomalyrect[3].bottom=rectHeight/4;
		
		anomalyrect[4].left=rectWidth/2+1;
		anomalyrect[4].top=rectHeight/4+1  ;
		anomalyrect[4].right=rectWidth/2+rectWidth/4;
		anomalyrect[4].bottom=rectHeight/2;
		
		anomalyrect[5].left=rectWidth/2+rectWidth/4;
		anomalyrect[5].top=rectHeight/4  ;
		anomalyrect[5].right=rectWidth;
		anomalyrect[5].bottom=rectHeight/2;
		
		anomalyrect[6].left=rectWidth/2+rectWidth/4;
		anomalyrect[6].top=0  ;
		anomalyrect[6].right=rectWidth;
		anomalyrect[6].bottom=rectHeight/4;	
		break;	
	case 6://---10p
		anomalyrect[0].left=0;
		anomalyrect[0].top=0  ;
		anomalyrect[0].right=rectWidth/2;
		anomalyrect[0].bottom=rectHeight/2;
		
		anomalyrect[1].left=0;
		anomalyrect[1].top=rectHeight/2+1  ;
		anomalyrect[1].right=rectWidth/4;
		anomalyrect[1].bottom=rectHeight/2+rectHeight/4;
		
		anomalyrect[2].left=0;
		anomalyrect[2].top=rectHeight/2+rectHeight/4  ;
		anomalyrect[2].right=rectWidth/4;
		anomalyrect[2].bottom=rectHeight-2;
		
		//---------------------------------------------------------
		anomalyrect[3].left=rectWidth/4;
		anomalyrect[3].top=rectHeight/2+1 ;
		anomalyrect[3].right=rectWidth/2;
		anomalyrect[3].bottom=rectHeight/2+rectHeight/4;
		
		anomalyrect[4].left=rectWidth/4;
		anomalyrect[4].top=rectHeight/2+rectHeight/4  ;
		anomalyrect[4].right=rectWidth/2;
		anomalyrect[4].bottom=rectHeight;
		
		anomalyrect[5].left=rectWidth/2;
		anomalyrect[5].top=rectHeight/2  ;
		anomalyrect[5].right=rectWidth/2+rectWidth/4;
		anomalyrect[5].bottom=rectHeight/2+rectHeight/4;	
		
		anomalyrect[6].left=rectWidth/2;
		anomalyrect[6].top=rectHeight/2+rectHeight/4  ;
		anomalyrect[6].right=rectWidth/2+rectWidth/4;
		anomalyrect[6].bottom=rectHeight;
		
		anomalyrect[7].left=rectWidth/2+rectWidth/4;
		anomalyrect[7].top=rectHeight/2  ;
		anomalyrect[7].right=rectWidth;
		anomalyrect[7].bottom=rectHeight/2+rectHeight/4;
		
		anomalyrect[8].left=rectWidth/2+rectWidth/4;
		anomalyrect[8].top=rectHeight/2+rectHeight/4  ;
		anomalyrect[8].right=rectWidth;
		anomalyrect[8].bottom=rectHeight;
		
		anomalyrect[9].left=rectWidth/2;
		anomalyrect[9].top=0  ;
		anomalyrect[9].right=rectWidth;
		anomalyrect[9].bottom=rectHeight/2;
		break;
	case 7:
		break;
	case 8://---8p
		anomalyrect[0].left=0;
		anomalyrect[0].top= 0;
		anomalyrect[0].right=rectWidth/2+rectWidth/4;
		anomalyrect[0].bottom=rectHeight/2+rectHeight/4 ;
		
		anomalyrect[1].left=0;
		anomalyrect[1].top=rectHeight/2+rectHeight/4;
		anomalyrect[1].right=rectWidth/4;
		anomalyrect[1].bottom=rectHeight-3;
		
		anomalyrect[2].left=rectWidth/4;
		anomalyrect[2].top=rectHeight/2+rectHeight/4;
		anomalyrect[2].right=rectWidth/2;
		anomalyrect[2].bottom=rectHeight - 3;
		
		
		//---------------------------------------------------------
		anomalyrect[3].left=rectWidth/2;
		anomalyrect[3].top=rectHeight/2+rectHeight/4;
		anomalyrect[3].right=rectWidth/2+rectWidth/4;
		anomalyrect[3].bottom=rectWidth - 153;
		
		anomalyrect[4].left=rectWidth/2+rectWidth/4;
		anomalyrect[4].top=rectHeight/2+rectHeight/4  ;
		anomalyrect[4].right=rectWidth;
		anomalyrect[4].bottom=rectHeight;
		
		anomalyrect[5].left=rectWidth/2+rectWidth/4;
		anomalyrect[5].top=0  ;
		anomalyrect[5].right=rectWidth;
		anomalyrect[5].bottom=rectHeight/4;
		
		anomalyrect[6].left=rectWidth/2+rectWidth/4;
		anomalyrect[6].top=rectHeight/4  ;
		anomalyrect[6].right=rectWidth;
		anomalyrect[6].bottom=rectHeight/2;
		
		anomalyrect[7].left=rectWidth/2+rectWidth/4;
		anomalyrect[7].top=rectHeight/2  ;
		anomalyrect[7].right=rectWidth;
		anomalyrect[7].bottom=rectHeight/2+rectHeight/4 ;

		break;
	case 9://---6p		
		anomalyrect[0].left=0;
		anomalyrect[0].top=0;
		anomalyrect[0].right=rectWidth/3 + rectWidth/3;
		anomalyrect[0].bottom=rectHeight/3 + rectHeight/3;
		
		anomalyrect[1].left= 0;
		anomalyrect[1].top=rectHeight/3 + rectHeight/3;	
		anomalyrect[1].right=rectWidth/3;
		anomalyrect[1].bottom=rectHeight - 3;
		
		anomalyrect[2].left = rectWidth/3 ;
		anomalyrect[2].top = rectHeight/3 + rectHeight/3;
		anomalyrect[2].right = rectHeight/3 + rectHeight/2;
		anomalyrect[2].bottom = rectHeight - 3;
		
		//---------------------------------------------------------
		anomalyrect[3].left = rectHeight/3 + rectHeight/2;
		anomalyrect[3].top = rectHeight/3 + rectHeight/3;
		anomalyrect[3].right=rectWidth - 3;
		anomalyrect[3].bottom=rectHeight - 3;
		
		anomalyrect[4].left = rectWidth/3 + rectWidth/3;
		anomalyrect[4].top = 0;
		anomalyrect[4].right=rectWidth - 3;
		anomalyrect[4].bottom=rectHeight/3;
		
		anomalyrect[5].left = rectWidth/3 + rectWidth/3;
		anomalyrect[5].top=rectHeight/3;
		anomalyrect[5].right=rectWidth - 3;
		anomalyrect[5].bottom=rectHeight/3 + rectHeight/3;

		break;
	case 10://---13p		
		anomalyrect[0].left=0;
		anomalyrect[0].top=0;
		anomalyrect[0].right=rectWidth/4;
		anomalyrect[0].bottom=rectHeight/4;
		
		anomalyrect[1].left=0;
		anomalyrect[1].top=rectHeight/4;
		anomalyrect[1].right=rectWidth/4;
		anomalyrect[1].bottom=rectHeight/2;
		
		anomalyrect[2].left=0;
		anomalyrect[2].top= rectHeight/2;
		anomalyrect[2].right=rectWidth/4;
		anomalyrect[2].bottom=rectHeight/2+rectHeight/4 ;
		
		//---------------------------------------------------------
		anomalyrect[3].left=0;
		anomalyrect[3].top=rectHeight/2+rectHeight/4;
		anomalyrect[3].right=rectWidth/4;
		anomalyrect[3].bottom=rectHeight - 3;
		
		anomalyrect[4].left=rectWidth/4+1;
		anomalyrect[4].top=rectHeight/2+rectHeight/4+1 ;
		anomalyrect[4].right=rectWidth/2;
		anomalyrect[4].bottom=rectHeight;
		
		anomalyrect[5].left=rectWidth/2+1;
		anomalyrect[5].top=rectHeight/2+rectHeight/4+1 ;
		anomalyrect[5].right=rectWidth/2+rectWidth/4;
		anomalyrect[5].bottom=rectHeight;
		
		anomalyrect[6].left=rectWidth/2+rectWidth/4+1;
		anomalyrect[6].top=rectHeight/2+rectHeight/4+1  ;
		anomalyrect[6].right=rectWidth;
		anomalyrect[6].bottom=rectHeight;
		
		anomalyrect[7].left=rectWidth/2+rectWidth/4+1;
		anomalyrect[7].top= rectHeight/2+1 ;
		anomalyrect[7].right=rectWidth;
		anomalyrect[7].bottom=rectHeight/2+rectHeight/4;
		
		//---------------------------------------------------------
		anomalyrect[8].left=rectWidth/2+rectWidth/4+1;
		anomalyrect[8].top=rectHeight/4+1 ;
		anomalyrect[8].right=rectWidth;
		anomalyrect[8].bottom=rectHeight/2;
		
		anomalyrect[9].left=rectWidth/2+rectWidth/4+1;
		anomalyrect[9].top=0 ;
		anomalyrect[9].right=rectWidth;
		anomalyrect[9].bottom=rectHeight/4-1;
		
		anomalyrect[10].left=rectWidth/2+1;
		anomalyrect[10].top=0 ;
		anomalyrect[10].right=rectWidth/2+rectWidth/4;
		anomalyrect[10].bottom=rectHeight/4-1;
		
		anomalyrect[11].left=rectWidth/4+1;
		anomalyrect[11].top=0 ;
		anomalyrect[11].right=rectWidth/2;
		anomalyrect[11].bottom=rectHeight/4-1;
		
		anomalyrect[12].left=rectWidth/4+1;
		anomalyrect[12].top=rectHeight/4 ;
		anomalyrect[12].right=rectWidth/2+rectWidth/4;
		anomalyrect[12].bottom=rectHeight/2+rectHeight/4;
		break;
	case 11:
		break;
	}
}

void CSshowCenter::CShowComPlete(CDC *dc, int num,CRect hrect)
{
//	RECT previewWnd;
	for(int count = 0; count< GetTotalDSPs(); count++)
	{
		::StopVideoPreview(ChannelHandle[count]);
		::ChannelClose(ChannelHandle[count]);
	}

	CRect allrect;
	allrect.left = 0;
	allrect.top = 0;
	allrect.right = 798;
	allrect.bottom = 798;
	GetClientRect(&hrect);
	
	CBrush *oldBrush = dc->SelectObject(&tempBrush);
	dc->Rectangle(&hrect);
	dc->SelectObject(oldBrush);
	
	int rectWidth = hrect.right - hrect.left;
	int rectHeight = hrect.bottom - hrect.top;
	
	int numRects = nSplitCount;
	CString str;
	
	ZeroMemory(rectList, sizeof(rectList));

	aheadCols = m_iCols;
	aheadrows = m_iRows;

	m_ballvedio = true;
	
	//调用CacRects判断是做几行几列的视频切分,并且设置显示通道的坐标;
	//---
//	numRects = CacRects(nSplitCount);
	//---
	for(int i = 0; i < 1; i++)//numRects
	{	
		::ChannelOpen(num);
		::StartVideoPreview(ChannelHandle[num], m_hWnd, &allrect, FALSE, vdfYUV422Planar, 25);	
		//-------------------------------		
		m_BackgroundDC.BitBlt(0, 0, m_rcWnd.Width(), m_rcWnd.Height(), GetDC() , 0, 0, SRCCOPY);
		CPen pen,*pOldPen;
		pen.CreatePen(PS_SOLID, 1, RGB(0,255,0));
		pOldPen = m_BackgroundDC.SelectObject(&pen);
		
		CRect rect;
		rect = m_rcWnd;
		rect.right = m_rcWnd.right-2;
		rect.bottom = m_rcWnd.bottom -2;
		
		CBrush* oldbrush;
		oldbrush=(CBrush *)m_BackgroundDC.SelectStockObject(NULL_BRUSH);
		m_BackgroundDC.Rectangle(rect);
		m_BackgroundDC.SelectObject(oldbrush);

		m_iCols = 1;
		m_iRows = 1;
		
		int RowSpacing, ColWidth;  
		RowSpacing = (rect.Height())/m_iRows;
		ColWidth = (rect.Width())/m_iCols;
		
		int j;
		//---画线从	MoveTo开始移动,终点LineTo!
		for (j=0; j<m_iRows; j++)//m_iRows
		{
			m_BackgroundDC.MoveTo(rect.left, rect.top + j*(rect.Height())/m_iRows);
			m_BackgroundDC.LineTo(rect.right, rect.top + j*(rect.Height())/m_iRows);
		}
		for (j=0; j<m_iCols; j++)//m_iCols
		{
			m_BackgroundDC.MoveTo(rect.left + j*(rect.Width())/m_iCols, rect.top);
			m_BackgroundDC.LineTo(rect.left + j*(rect.Width())/m_iCols, rect.bottom);
		}
		
		m_BackgroundDC.SelectObject(pOldPen);	
		GetDC()->BitBlt(0, 0, m_rcWnd.Width(), m_rcWnd.Height(), &m_BackgroundDC , 0, 0, SRCCOPY);
		//--------------------------
		str.Format(strArray1[i]);
		
		dc->SetTextColor(RGB(255,0,0));
		dc->SetBkMode(TRANSPARENT);	
		dc->TextOut(rectList[i].left+5,rectList[i].top+10,str);
	}	
}

void CSshowCenter::ChangeControl()
{	
	if(m_bClicbutton)
	{			
		if(DisplayMode == VIDEO_SINGLE_CHANNEL)			
		{	
			for(int count = 0; count< GetTotalDSPs(); count++)
			{
				::StopVideoPreview(ChannelHandle[count]);
			}
			if(m_ballvedio)
			{
				m_iCols = aheadCols;//把改变的值复原
				m_iRows = aheadrows;				
				Invalidate();
				m_ballvedio = false;
			}
			m_bDisplayTimer = FALSE;	
			CDC *pDC = GetDC();	
			ReleaseDC(pDC);	//释放pDC指针			
			DisplayMode = VIDEO_MULTI_CHANNEL;	
		}
	}	
	//---------------以下是不规则画法-----------------------------------
	else	
		if(DisplayMode == VIDEO_SINGLE_CHANNEL)			
		{
			for(int count = 0; count< GetTotalDSPs(); count++)
			{
				::StopVideoPreview(ChannelHandle[count]);
			}
			if(m_ballvedio)
			{
				m_choosplay =false;
				m_bFirst = true;
				Invalidate();
				m_ballvedio = false;
			}		
		}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -