Exemple #1
0
void CMonitorWnd::UpdateWnd()
{
	if(!IsWindowVisible() || IsIconic())
	{
		return;
	}

	CRect rectContainer;
	GetClientRect(&rectContainer);
	GetShowRect(&rectContainer);
//	rectContainer.DeflateRect(1,1);

	if(m_bAutoAdjustPos)
	{
		AdjustRect(&rectContainer);
	}

	if(m_bMultiScreen)
	{
		CRect rect;
		int nCount = m_PageList.GetCount();
		int i = 0;
		for(POSITION pos = m_PageList.GetHeadPosition(); pos != NULL; i++)
		{
			CWnd *pWnd = m_PageList.GetNext(pos);

			rect = rectContainer;
			CalcPageRect(&rect, i, nCount);
			rect.DeflateRect(WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE); // 窗口之间的间隔
			pWnd->MoveWindow(&rect);
			pWnd->ShowWindow(SW_SHOW);
		}
	}
	else
	{
		for(POSITION pos = m_PageList.GetHeadPosition(); pos!=NULL;)
		{
			CWnd *pWnd = m_PageList.GetNext(pos);
			if(pWnd == m_pActivePage)
			{
				CRect rect = rectContainer;
				rect.DeflateRect(WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE);
				pWnd->MoveWindow(&rect);
				pWnd->ShowWindow(SW_SHOW);
			}
			else 
			{
				pWnd->MoveWindow(rectContainer.right+1, rectContainer.bottom+1, 1, 1);
//				pWnd->ShowWindow(SW_HIDE);
			}
		}
	}

	if(m_bDrawActive && m_PageList.GetCount() > 1)
	{
		DrawActivePage(TRUE);
	}
}
Exemple #2
0
BOOL CDibBitmap::DrawStrechFromCenter(CDC *pDC)
{
	if(m_rect!= CRect(0,0,0,0))
	{
		CRect imgrc(0,0,m_lpBMIH->biWidth,m_lpBMIH->biHeight);
		GetShowRect(imgrc,m_rect);
		::StretchDIBits(pDC->GetSafeHdc(), m_rect.left,m_rect.top,m_rect.Width(),m_rect.Height(),
			imgrc.left, imgrc.top, imgrc.Width(), imgrc.Height(),	
			m_lpImage, (LPBITMAPINFO) m_lpBMIH, DIB_RGB_COLORS, SRCCOPY);
	}
	return TRUE;
}
Exemple #3
0
///////////////////////////////////////////////////
// call this function to  page wnds,when
// the window is resized.
void CBSWndContainer::UpdateWnd()
{
	if(!IsWindowVisible()||IsIconic()) return;
/////////////////////
//计算显示总区域

	//得到窗口的设备坐标
	CRect rtContainer;
	GetClientRect(&rtContainer);
	GetShowRect(&rtContainer);
	rtContainer.DeflateRect(1,1);

	//调整Container位置
	if(m_bAutoAdjustPos)		
		AdjustRect(&rtContainer);

/////////////////////
//
	if(m_bMultiScreen)
	{ //多屏状态
		CRect rt;
		int nCount=m_PageList.GetCount();
		int i=0;
		for(POSITION pos=m_PageList.GetHeadPosition();pos!=NULL;)
		{
			CWnd *p=m_PageList.GetNext(pos);

			rt=rtContainer;
			CalcPageRect(&rt,i,nCount);
			rt.DeflateRect(WINDOW_SPACE,WINDOW_SPACE,WINDOW_SPACE,WINDOW_SPACE); //窗口之间的间隔
			p->MoveWindow(&rt);
			p->ShowWindow(SW_SHOW);
			i++;
		}
		if( m_bDrawActive && m_PageList.GetCount()>1 ) DrawActivePage(TRUE);
	}
	else
	{ //单屏状态
		for(POSITION pos=m_PageList.GetHeadPosition();pos!=NULL;)
		{
			CWnd *p=m_PageList.GetNext(pos);
			if(p==m_pActivePage)
				p->MoveWindow(&rtContainer);
			else 
			{
				if(m_bFullScreen)
					p->MoveWindow(0,0,1,1);
				else
					p->MoveWindow(rtContainer.right+1,rtContainer.bottom+1,1,1);
			}
		}
	}
}