Search

'전체 글'에 해당되는 글 113건

  1. 2007.01.11 ActiveX가 있는 페이지를 스크롤하면 화면이 깨져보일경우
VC++ 에서 만든 MFC ActiveX 가 그런거 같더군여.. 비베로 만든 ActiveX 는 안그런걸로 알고 있습니다..

암튼.. 해결 방법은

일일히 해당 컨트롤들을 Invalidate 해주는 방법이 있는데 이것도 깔끔하게는 안되더군여..

그래서 정법을 소개합니다.. 이걸로 하니 깔끔하게 잘되더군여..



/////

1.. 먼저  헤더파일에..



public:

virtual BOOL OnSetObjectRects(LPCRECT lpRectPos, LPCRECT lpRectClip);   //오버라이드



private:

void    MyGetClippingCoordinates(LPCRECT pPosRect, LPCRECT pClipRect,

                      LPRECT pIntersectRect, LPPOINT pOffsetPoint);







2. CPP 파일에...



void CxxxCtrl::MyGetClippingCoordinates(LPCRECT pPosRect, LPCRECT pClipRect,

                        LPRECT pIntersectRect, LPPOINT pOffsetPoint)

{

    int clipLeft = 0;

    int clipTop = 0;



    if ((pClipRect == NULL) || IsRectEmpty(pClipRect))

    {

        CopyRect(pIntersectRect, pPosRect);

    }

    else

    {

        IntersectRect(pIntersectRect, pPosRect, pClipRect);

        clipLeft = pClipRect->left;

        clipTop = pClipRect->top;

    }



    pOffsetPoint->x = min(0, pPosRect->left - clipLeft);

    pOffsetPoint->y = min(0, pPosRect->top - clipTop);

}





BOOL CxxxCtrl::OnSetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect)

{

    ASSERT(lprcPosRect != NULL);



    // Remember the position rectangle for later

    m_rcPos = *lprcPosRect;



    // Calculate complete rectangle including the tracker (if present)

    CRect rectPos = m_rcPos;

    if (m_bUIActive && m_pRectTracker != NULL)

    {

        // Save new clipping rectangle (for DestroyTracker)

        if (lprcClipRect != NULL)

            m_pRectTracker->m_rectClip = *lprcClipRect;



        // Adjust tracker rectangle to new dimensions

        CRect rectTmp = rectPos;

        rectTmp.OffsetRect(-rectTmp.left, -rectTmp.top);

        m_pRectTracker->m_rect = rectTmp;



        // Adjust the "true" rectangle to include handles/hatching

        UINT nHandleSize = m_pRectTracker->m_nHandleSize - 1;

        rectPos.InflateRect(nHandleSize, nHandleSize);

    }



    // Now clip that rectangle as appropriate

    CRect rectClip;



    // CHANGE - call your own copy of _GetClippingCoordinates

    MyGetClippingCoordinates(rectPos, lprcClipRect, rectClip, &m_ptOffset);



    // Move outer window first. then inner window



    if (!m_bInPlaceSiteWndless)

    {

        CWnd* pWndOuter = GetOuterWindow();

        

        //BEGIN CHANGE

        if (pWndOuter != NULL)

        {



               ::MoveWindow(pWndOuter->m_hWnd, rectPos.left, rectPos.top,

                    rectPos.Width(), rectPos.Height(), TRUE);

        }

        //END CHANGE                                

        if (pWndOuter != this)

            MoveWindow(0, 0, rectPos.Width(), rectPos.Height());

    }



    return TRUE;

}