Esempio n. 1
0
void CResizableImage::AddAnchor(RECT PixelSurface, SIZE LTType, SIZE RBType, ZoomType ZoomVal)
{
	SIZE tmpSizeLT = {PixelSurface.left,PixelSurface.top}, tmpSizeRB = {PixelSurface.right,PixelSurface.bottom};
	PixelToHiMetric(&tmpSizeLT,&tmpSizeLT);
	PixelToHiMetric(&tmpSizeRB,&tmpSizeRB);
	
	RECT HiSurface;
	HiSurface.left = tmpSizeLT.cx;
	HiSurface.top = tmpSizeLT.cy;
	HiSurface.right = tmpSizeRB.cx;
	HiSurface.bottom = tmpSizeRB.cy;

	Layout	newItem(HiSurface, PixelSurface, LTType, RBType, ZoomVal);
	m_SurfacesList.push_back(newItem);
}
Esempio n. 2
0
void CActiveXUI::SetPos(RECT rc)
{
    CControlUI::SetPos(rc);

    if( !m_bCreated ) DoCreateControl();

    if( m_pUnk == NULL ) return;
    if( m_pControl == NULL ) return;

    SIZEL hmSize = { 0 };
    SIZEL pxSize = { 0 };
    pxSize.cx = m_rcItem.right - m_rcItem.left;
    pxSize.cy = m_rcItem.bottom - m_rcItem.top;
    PixelToHiMetric(&pxSize, &hmSize);

    if( m_pUnk != NULL ) {
        m_pUnk->SetExtent(DVASPECT_CONTENT, &hmSize);
    }
    if( m_pControl->m_pInPlaceObject != NULL ) {
        CRect rcItem = m_rcItem;
        if( !m_pControl->m_bWindowless ) rcItem.ResetOffset();
        m_pControl->m_pInPlaceObject->SetObjectRects(&rcItem, &rcItem);
    }
    if( !m_pControl->m_bWindowless ) {
        ASSERT(m_pControl->m_pWindow);
        ::MoveWindow(*m_pControl->m_pWindow, m_rcItem.left, m_rcItem.top, m_rcItem.right - m_rcItem.left, m_rcItem.bottom - m_rcItem.top, TRUE);
    }
}
Esempio n. 3
0
void AxContainer::SetGeometry( const RECT &rcWnd )
{
	SIZEL hmSize = { 0 };
	SIZEL pxSize = { 0 };
	pxSize.cx = rcWnd.right-rcWnd.left;
	pxSize.cy = rcWnd.bottom-rcWnd.top;
	PixelToHiMetric(&pxSize, &hmSize);

	if ( m_pOleObject != NULL ) 
	{
		m_pOleObject->SetExtent(DVASPECT_CONTENT, &hmSize);
	}

	if ( m_pInPlaceObject != NULL ) 
	{
		RECT rcItem = rcWnd;
		if( !m_bWindowless ) 
			::OffsetRect(&rcItem, -rcItem.left, -rcItem.top);
		m_pInPlaceObject->SetObjectRects(&rcItem, &rcItem);
	}
	if ( !m_bWindowless && m_pWindow) 
	{
		::MoveWindow(*m_pWindow, rcWnd.left, rcWnd.top, rcWnd.right-rcWnd.left, rcWnd.bottom-rcWnd.top, TRUE);
	}
}
Esempio n. 4
0
void CResizableImage::Render(HDC hDC, const RECT &Rect)
{
	RECT rbBoundRect = {0,0,0,0};
	
	SIZE HiRectSize	=	{0};
	
	//PixelToHiMetric(&RectSize,&HiRectSize);
	CSize PixelZoomSize;
	PixelZoomSize.cx = Rect.right - Rect.left - m_RealSize.cx;
	PixelZoomSize.cy = Rect.bottom - Rect.top - m_RealSize.cy;
	
	for(std::list<Layout>::iterator i = m_SurfacesList.begin();i!=m_SurfacesList.end();i++)
	{
		RECT	newDestSurfaceRect;
		
		newDestSurfaceRect.left		= Rect.left + (*i).PixelSurface.left + PixelZoomSize.cx*(*i).LTType.cx/100;
		newDestSurfaceRect.right	= Rect.left + (*i).PixelSurface.right + PixelZoomSize.cx*(*i).RBType.cx/100;
		newDestSurfaceRect.top		= Rect.top + (*i).PixelSurface.top + PixelZoomSize.cy*(*i).LTType.cy/100;
		newDestSurfaceRect.bottom	= Rect.top + (*i).PixelSurface.bottom + PixelZoomSize.cy*(*i).RBType.cy/100;
		
		_ASSERTE(m_pImage!=NULL);
		
		switch((*i).ZoomVal)
		{
		case STRETCH:
			m_pImage->Render(hDC,
				newDestSurfaceRect.left, newDestSurfaceRect.top,
				newDestSurfaceRect.right-newDestSurfaceRect.left, newDestSurfaceRect.bottom-newDestSurfaceRect.top,
				(*i).HiSurface.left,m_ImageSize.cy-(*i).HiSurface.top,
				(*i).HiSurface.right-(*i).HiSurface.left,-(*i).HiSurface.bottom+(*i).HiSurface.top,
				&rbBoundRect);
			break;
		case DUPLICATE:
			{
				SIZE SrcPixel, DestPixel, AddonPixel, AddonHi, SrcHi;
				
				DestPixel.cx	=	newDestSurfaceRect.right - newDestSurfaceRect.left;
				DestPixel.cy	=	newDestSurfaceRect.bottom - newDestSurfaceRect.top;
				SrcPixel.cx		=	(*i).PixelSurface.right-(*i).PixelSurface.left;
				SrcPixel.cy		=	(*i).PixelSurface.bottom-(*i).PixelSurface.top;
				
				int WidthAddonCount		= DestPixel.cx/SrcPixel.cx;
				int HeightAddonCount	= DestPixel.cy/SrcPixel.cy;
				
				AddonPixel.cx	=	DestPixel.cx-WidthAddonCount*SrcPixel.cx;
				AddonPixel.cy	=	DestPixel.cy-HeightAddonCount*SrcPixel.cy;
				
				PixelToHiMetric(&AddonPixel,&AddonHi);
				PixelToHiMetric(&SrcPixel,&SrcHi);
				
				for(int xIter=0;xIter<=WidthAddonCount;xIter++)
					for(int yIter=0;yIter<=HeightAddonCount;yIter++)
					{
						m_pImage->Render(hDC,
							newDestSurfaceRect.left+SrcPixel.cx*xIter,
							newDestSurfaceRect.top+SrcPixel.cy*yIter,
							(xIter==WidthAddonCount)?(AddonPixel.cx):(SrcPixel.cx),
							(yIter==HeightAddonCount)?(AddonPixel.cy):(SrcPixel.cy),
							(*i).HiSurface.left,
							m_ImageSize.cy-(*i).HiSurface.top,
							(xIter==WidthAddonCount)?(AddonHi.cx):(SrcHi.cx),
							(yIter==HeightAddonCount)?(-AddonHi.cy):(-SrcHi.cy),
							&rbBoundRect);
					}
			}
			break;
		default:
			_ASSERTE(FALSE);
		}
	}
}