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;
}
암튼.. 해결 방법은
일일히 해당 컨트롤들을 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;
}
'Program Visual C++' 카테고리의 다른 글
ActiveX 콘트롤 디버깅하기 (0) | 2007.01.24 |
---|---|
VC++ 다중 프로잭트 종속관계 설정 (0) | 2007.01.24 |
다이얼로그 베이스에서 초기 실행시 다이얼로그 감추기 (0) | 2007.01.16 |
View/Document구조에서 각각의 핸들 구하기. (0) | 2005.10.21 |
About DLL part 1 (DLL의 종류) (0) | 2005.08.25 |