Example #1
0
HRGN CSkinWin::GetRegion(int w, int h)
{
    CWnd *pWnd = CWnd::FromHandle(m_hWnd);
    CRect wr;
    pWnd->GetWindowRect(wr);
	//SKIN_SHANG 右边框
	//wr.left+=m_BorderRightWidth;
    
    CRgn rgn;
    if ( m_bTrans )
    {
        CDC *pDC = pWnd->GetDC();
        CDC memDC;
        CMyBitmap bmp;
        CBitmap *obmp;
        memDC.CreateCompatibleDC(pDC);
        bmp.CreateCompatibleBitmap( pDC, w, m_TitleHeight );
        obmp = memDC.SelectObject(&bmp);
        /*
        memDC.FillSolidRect( 0, 0, w, h, 0 );
        DrawFrame( &memDC, 0, 0, w, h, 0 );
        */
        DrawTitle( &memDC, m_BorderLeftWidth , 0, 
                   wr.Width() - m_BorderRightWidth - m_BorderLeftWidth + 1, 0 );
        DrawLeft( &memDC, 0, 0, m_bmpLeft.Height(), 0 );
		//SKIN_SHANG 右边框
        DrawRight( &memDC, wr.Width() - m_BorderRightWidth , 0, m_bmpRight.Height(), 0 );
        
        memDC.SelectObject(obmp);

		//wyw
		memDC.DeleteDC();

        pWnd->ReleaseDC( pDC );

        rgn.CreateRectRgn( 0, m_TitleHeight, wr.Width(), wr.Height() );
        HRGN hrgn = bmp.CreateRgnFromFile( m_colTrans );
        CRgn newrgn;
        newrgn.CreateRectRgn( 0, m_TitleHeight, wr.Width(), wr.Height() );
        newrgn.CombineRgn( &rgn, CRgn::FromHandle(hrgn), RGN_XOR  );

		//wyw
		bmp.DeleteObject();
		DeleteObject(hrgn);
		rgn.DeleteObject();
        
        return (HRGN)newrgn.Detach();
    }
    else
        rgn.CreateRectRgn( 0, 0, wr.Width(), wr.Height() );
        
    
    return (HRGN)rgn.Detach();
}
Example #2
0
int COXSplashWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
	{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	if ((HRGN)m_rgn != NULL)
		{
		CRgn rgn;
		rgn.CreateRectRgn(0,0,1,1);
		switch(rgn.CopyRgn(&m_rgn))
			{
			case ERROR:
				TRACE0("COXSplashWnd::OnCreate(): fail to load the calculated region.\r\n");
				rgn.DeleteObject();
				break;
			case NULLREGION:
				TRACE0("COXSplashWnd::OnCreate(): empty region was encountered.\r\n");
				rgn.DeleteObject();
				break;
			default:
				::SetWindowRgn(m_hWnd, (HRGN)rgn.Detach(), TRUE);
			}
		}
	
	CenterWindow();
	if (m_nTimeout != SPLASH_NOTIMER)
		SetTimer(OXSPLASHWND_TIMERID_HIDE, m_nTimeout, NULL);

	SetCapture();
	::SetCursor(::LoadCursor(NULL, IDC_ARROW));
	
	return 0;
	}
Example #3
0
//创建区域
bool CRgnDialog::CreateControlRgn(COLORREF crTrans)
{
	//加载资源
	CImageHandle ImageHandle(&m_ImageBack);

	//创建区域
	CRgn RgnControl;
	m_ImageBack.CreateImageRegion(RgnControl,crTrans);

	//设置窗口
	if (RgnControl.GetSafeHandle()!=NULL)
	{
		//移动窗口
		SetWindowRgn(RgnControl,TRUE);
		SetWindowPos(NULL,0,0,m_ImageBack.GetWidth(),m_ImageBack.GetHeight(),SWP_NOMOVE);

		//删除区域
		m_DialogRgn.DeleteObject();
		m_DialogRgn.Attach(RgnControl.Detach());

		return true;
	}

	return false;
}
Example #4
0
BOOL CSkinButton::GetRegion()
{
	CMyBitmap bmp;
	/*
		if ( hRgn ) 
	{
		dc.SelectClipRgn(NULL);
		DeleteObject(hRgn);
	}
	HRGN  hRgn = NULL;
	if ( m_res->m_bTrans )
	{
		HRGN rgn;
		rgn = bmp.CreateRgnFromFile(RGB(255,0,255));
		//strange, must after ClipRgn
		//SetWindowPos( NULL, 0, 0, bmp.Width(), bmp.Height(), SWP_NOZORDER | SWP_NOMOVE );
		HRGN hRgn = CreateRectRgn(0, 0, 0, 0);
		SetWindowRgn( rgn, TRUE );	
		GetWindowRgn(hRgn);				
		::SelectClipRgn(dc.GetSafeHdc(), hRgn);
	}
	*/
	//DrawImage( bmp );
	CRgn rgn;
	rgn.CreateEllipticRgn( 00, 00, 50, 50 );
	SetWindowRgn((HRGN)rgn.Detach(), TRUE );
	//SetWindowRgn(bmp.CreateRgnFromFile(RGB(255,0,255)), TRUE );
	return TRUE;
}
void CResizableGrip::CSizeGrip::SetTriangularShape(BOOL bEnable)
{
	m_bTriangular = bEnable;

	if (bEnable)
	{
		// set a triangular window region
		CRect rect;
		GetWindowRect(rect);
		rect.OffsetRect(-rect.TopLeft());
		POINT arrPoints[] =
		{
			{ rect.left, rect.bottom },
			{ rect.right, rect.bottom },
			{ rect.right, rect.top }
		};
		CRgn rgnGrip;
		rgnGrip.CreatePolygonRgn(arrPoints, 3, WINDING);
		SetWindowRgn((HRGN)rgnGrip.Detach(), IsWindowVisible());
	}
	else
	{
		SetWindowRgn((HRGN)NULL, IsWindowVisible());
	}
}
Example #6
0
BOOL CVisualManager::OnSetWindowRegion (CWnd* pWnd, CSize sizeWindow)
{
	ASSERT_VALID (pWnd);

	if (pWnd->GetSafeHwnd () == NULL)
	{
		return FALSE;
	}

	if (!CanDrawImage ())
	{
		return FALSE;
	}

	if (globalData.DwmIsCompositionEnabled ())
	{
		return FALSE;
	}

    CSize sz (0, 0);

	if (DYNAMIC_DOWNCAST (CBCGPFrameWnd, pWnd) != NULL)
	{
		if (pWnd->IsZoomed ())
		{
			pWnd->SetWindowRgn (NULL, TRUE);
			return TRUE;
		}

		sz  = CSize (9, 9);
	}

	if (sz != CSize (0, 0))
	{
        CRgn rgn;
		BOOL bCreated = FALSE;

		bCreated = rgn.CreateRoundRectRgn (0, 0, sizeWindow.cx + 1, sizeWindow.cy + 1, sz.cx, sz.cy);

		if (bCreated)
		{
			if (pWnd->IsKindOf (RUNTIME_CLASS (CMDIChildWnd)))
			{
				CRgn rgnWinodw;
				rgnWinodw.CreateRectRgn (0, sz.cy, sizeWindow.cx, sizeWindow.cy);

				rgn.CombineRgn (&rgn, &rgnWinodw, RGN_OR);
			}

			pWnd->SetWindowRgn ((HRGN)rgn.Detach (), TRUE);
			return TRUE;
		}
	}

	return FALSE;
}
BOOL CSkinButton::GetRegion()
{
    CMyBitmap bmp;
    CRgn rgn;
    rgn.CreateEllipticRgn( 00, 00, 50, 50 );
    SetWindowRgn((HRGN)rgn.Detach(), TRUE );

	//wyw
#if 1
	rgn.DeleteObject();
#endif

    return TRUE;
}
Example #8
0
BOOL CResizeDlg::OnInitDialog() 
{
	BOOL bret = CDialog::OnInitDialog();

	CRect	cltRect;
	CBitmap cBmpSize;
	BITMAP	Bitmap;

	GetClientRect(&cltRect);
	m_cltR0 = cltRect;
	ClientToScreen(&m_cltR0);
	m_cltRect = m_cltR0;

	cBmpSize.LoadOEMBitmap(OBM_SIZE);
	cBmpSize.GetBitmap(&Bitmap);

	m_wndSizeIcon.Create(NULL, 
		WS_CHILD | WS_VISIBLE | SS_BITMAP, 
		CRect(0, 0, Bitmap.bmWidth, Bitmap.bmHeight),
		this, 
		m_idSizeIcon);

	m_wndSizeIcon.SetBitmap(cBmpSize);
	m_wndSizeIcon.SetWindowPos(&wndTop,
				cltRect.right - Bitmap.bmWidth, cltRect.bottom - Bitmap.bmHeight,
				0, 0,
				SWP_NOSIZE);
#if 0
	CRgn  cRgn;
	POINT bmpPt[3] = { { cltRect.right - Bitmap.bmWidth, cltRect.bottom },
					   { cltRect.right, cltRect.bottom - Bitmap.bmHeight},
					   { cltRect.right, cltRect.bottom } };
	cRgn.CreatePolygonRgn(bmpPt, 3, WINDING);
	m_wndSizeIcon.SetWindowRgn(cRgn, TRUE);

	cRgn.Detach();
#endif

	cBmpSize.Detach();

	AddControl(m_idSizeIcon, CST_REPOS, CST_REPOS, CST_REPOS, CST_REPOS);

	CRect wRect;
	GetWindowRect(&wRect);
	m_xMin = wRect.Width();		// default x limit
	m_yMin = wRect.Height();	// default y limit

	return bret;
}
Example #9
0
//*****************************************************************************
BOOL CMacStyle::OnSetWindowRegion (CWnd* pWnd, CSize sizeWindow)
{
	ASSERT_VALID (pWnd);

	if (pWnd->GetSafeHwnd () == NULL)
	{
		return FALSE;
	}

    CSize sz (0, 0);

	BOOL bMainWnd = pWnd == AfxGetMainWnd ();

	if (bMainWnd)
	{
		if ((pWnd->GetStyle () & WS_MAXIMIZE) == WS_MAXIMIZE)
		{
			pWnd->SetWindowRgn (NULL, TRUE);
			return TRUE;
		}

		sz  = CSize (9, 9);

		bMainWnd = TRUE;
	}

	if (sz != CSize (0, 0))
	{
        CRgn rgn;
		BOOL bCreated = FALSE;

		bCreated = rgn.CreateRoundRectRgn (0, 0, sizeWindow.cx + 1, sizeWindow.cy + 1, sz.cx, sz.cy);

		if (bCreated)
		{
			pWnd->SetWindowRgn ((HRGN)rgn.Detach (), TRUE);
			return TRUE;
		}
	}

	return FALSE;
}
Example #10
0
CDimWnd::CDimWnd(CRect rect)
{
	// Get screen res into rect
//	RECT rc;
//	GetDesktopWindow()->GetWindowRect(&rc);

	CreateEx(WS_EX_LAYERED |        // Layered window for translucency
			WS_EX_TRANSPARENT |    // Click through
			WS_EX_TOPMOST |        // Always on top
			WS_EX_TOOLWINDOW,      // Do not appear in taskbar & similar
			NULL, TEXT(""), 
			WS_POPUP,              // No frame/borders - though there is 
                                    // still some border left - we'll remove 
                                    // it with regions

//			0, 0, rc.right + 10, rc.bottom + 10, // Make the window 10px larger 
 //                                                     // than screen resolution in both 
 //                                                     // directions - it is still positioned 
  //                                                    // at 0,0
			0, 0, rect.Width() + 10, rect.Height() + 10, 
			NULL, NULL);

	// Grab a part of the window the size of the desktop - but 5px into it  
	// Because the window is larger than the desktop res, the borders are removed 
	CRgn rgn;                         
//	rgn.CreateRectRgn(rect.left + 5, rect.top + 5, rect.right + 5, rect.bottom + 5);
	rgn.CreateRectRgn(5, 5, rect.Width()+5, rect.Height()+5);
	SetWindowRgn((HRGN)rgn, FALSE);
	rgn.Detach();                               

//	// We have to reposition window - (0,0) of window has not changed
	SetWindowPos(NULL, rect.left-5, rect.top-5, 0, 0, SWP_NOSIZE | SWP_NOZORDER);     
//	SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
//	MoveWindow();

	// This is where we set the opacity of the window: 0-255
	SetLayeredWindowAttributes(RGB(200,200,200), 180, LWA_ALPHA);                     
}
Example #11
0
//创建区域
bool CRgnButton::CreateControlRgn(COLORREF crTrans)
{
	CImageHandle ImageHandle(&m_ImageBack);
	if (ImageHandle.IsResourceValid())
	{
		//创建临时图
		CSkinImage BufferImage;
		int nButtonWidth=m_ImageBack.GetWidth()/5;
		int nButtomHeight=m_ImageBack.GetHeight();
		BufferImage.Create(nButtonWidth,nButtomHeight,24);
		ImageHandle->BitBlt(BufferImage.GetDC(),0,0,nButtonWidth,nButtomHeight,0,0);
		BufferImage.ReleaseDC();

		//创建区域
		CRgn RgnControl;
		BufferImage.CreateImageRegion(RgnControl,crTrans);

		//创建区域
		if (RgnControl.GetSafeHandle()!=NULL)
		{
			//设置变量
			m_crTrans=crTrans;

			//设置按钮
			SetWindowRgn(RgnControl,TRUE);
			SetWindowPos(NULL,0,0,nButtonWidth,nButtomHeight,SWP_NOMOVE|SWP_NOACTIVATE);

			//设置区域
			m_ButtonRgn.DeleteObject();
			m_ButtonRgn.Attach(RgnControl.Detach());

			return true;
		}
	}

	return false;
}
Example #12
0
LRESULT CRegionSelect::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	int cx = LOWORD(lParam); 
	int cy = HIWORD(lParam);
	DWORD fwKeys = wParam;
	POINT point = {cx, cy};
	HWND hNewSelWnd;

	
		/*CRect toolbarRC;
		Toolbar.GetWindowRect(&toolbarRC);
		toolbarRC.InflateRect(30,70);
		bool HideToolBar = true;
		if(toolbarRC.PtInRect(point))
		{
			if(!(fwKeys & MK_LBUTTON) && 	!(fwKeys & MK_RBUTTON))
			{
				HideToolBar = false;
				if(!m_btoolWindowTimerRunning)
				{
					SetTimer(1,400);
					m_btoolWindowTimerRunning = true;
				}
			}
		//do smth	
		}
		else
		{
			if(m_btoolWindowTimerRunning)
			KillTimer(1);
			m_btoolWindowTimerRunning = false;
			Toolbar.ShowWindow(SW_HIDE);
		}*/


	bool bUpdateWindow = false;

	if(m_SelectionMode == smWindowHandles)
	{
		POINT newP=point;
		ClientToScreen(&newP );

      if ((hNewSelWnd = WindowUnderCursor(newP,m_hWnd)) == 0)
        hNewSelWnd = ::GetDesktopWindow();
      else
      {
        /*HWND hChildWnd = MyChildWindowFromPoint(hNewSelWnd, point);
        if ( hChildWnd )
          hNewSelWnd = hChildWnd;*/
      }
		if(hNewSelWnd != hSelWnd)
      {
			CRgn FullScreenRgn;
		

			FullScreenRgn.CreateRectRgnIndirect(&m_screenBounds);
			RECT SelWndRect;
			::GetWindowRect( hNewSelWnd, &SelWndRect );
			CRgn WindowRgn;
			  
			if(::GetWindowRgn(hNewSelWnd, WindowRgn) != ERROR)
			{
				//WindowRegion.GetRgnBox( &WindowRect); 
				WindowRgn.OffsetRgn( SelWndRect.left, SelWndRect.top);
			}
		  
			CBrush br;
			br.CreateSolidBrush(RGB(200,0,0));
		
			m_bPictureChanged = true;
			m_PrevWindowRect = SelWndRect;
		  
			CRgn repaintRgn;
			repaintRgn.CreateRectRgnIndirect(&SelWndRect);
			repaintRgn.OffsetRgn(topLeft);

			if(!m_prevWindowRgn.IsNull())
			repaintRgn.CombineRgn(m_prevWindowRgn, RGN_OR);
			

			
			m_prevWindowRgn = repaintRgn;
			InvalidateRgn(repaintRgn);
			repaintRgn.Detach();
			bUpdateWindow = true;
      }
		hSelWnd = hNewSelWnd;

		if(!(wParam & MK_RBUTTON))
		{
			bUpdateWindow = true;
		}
	}
	//else
	{
		if(fwKeys & MK_LBUTTON && Down	)
		{
			HDC dc = GetDC();
			
			SelectObject(dc, pen);

			if(m_SelectionMode!=smFreeform)
			{
				SetROP2(dc, R2_NOTXORPEN);
				if(End.x>-1)
					Rectangle(dc, Start.x,Start.y, End.x, End.y);

				End.x = LOWORD(lParam); 
				End.y = HIWORD(lParam);

				bool Draw = true;
				if(m_SelectionMode == smWindowHandles)
				{
				
					if(abs(End.x-Start.x)<7 && abs(End.y-Start.y)<7)
					{
						Draw=false;
					}
					else 	
					{
						m_SelectionMode = smRectangles;
						hSelWnd = 0;
						m_bPictureChanged = true;
						/*Invalidate();*/
						bUpdateWindow = true;
					}
				}
					if(Draw) Rectangle(dc, Start.x,Start.y, End.x, End.y);
				
				
			}
			else
			{
				SetROP2(doubleDC, R2_COPYPEN);
				POINT p = m_curvePoints.back();
				MoveToEx(doubleDC, p.x, p.y,0);
				SelectObject(doubleDC, pen);
				POINT newPoint  = {LOWORD(lParam), HIWORD(lParam)};
				LineTo(doubleDC, newPoint.x, newPoint.y);
				m_curvePoints.push_back(newPoint);

				RECT RectToRepaint;
				RectToRepaint.left = min(p.x, newPoint.x) - m_brushSize;
				RectToRepaint.top = min(p.y, newPoint.y) - m_brushSize;
				RectToRepaint.right = max(p.x, newPoint.x) + m_brushSize;
				RectToRepaint.bottom = max(p.y, newPoint.y) + m_brushSize;
				InvalidateRect(&RectToRepaint, false);

			}
			ReleaseDC(dc);
		}
}
		if(wParam & MK_RBUTTON)
		{
			HGDIOBJ oldPen2 = SelectObject(memDC2, DrawingPen);

			if(cxOld != -1)
			{
				SHORT shiftState = GetAsyncKeyState(VK_SHIFT);
				if(shiftState& 0x8000) {
					if (!lineType ) {
						lineType = abs(cx-cxOld) >= abs(cy-cyOld) ? 1 : 2;
					}
					if ( lineType == 1 ) {
						cy = cyOld;
					} else {
						cx = cxOld;
					}
				}


				SelectClipRgn(memDC2, 0);
				MoveToEx(memDC2, cxOld, cyOld,0);
				LineTo(memDC2, cx,cy);

				RECT RectToRepaint;
				RectToRepaint.left = min(cxOld, cx) - m_brushSize;
				RectToRepaint.top = min(cyOld, cy) - m_brushSize;
				RectToRepaint.right = max(cxOld, cx) + m_brushSize;
				RectToRepaint.bottom = max(cyOld, cy) + m_brushSize;
				CRgn rgn;
				rgn.CreateRectRgnIndirect(&RectToRepaint);
				m_bPictureChanged = true;
				m_bDocumentChanged = true;
				InvalidateRect(&RectToRepaint);
				UpdateWindow();
			}
			cxOld = cx;
			cyOld = cy;	
		}

	if(bUpdateWindow) UpdateWindow();
	return 0;
}
Example #13
0
// this routine calculates the size and position of the window relative
// to it's anchor point, and moves the window accordingly.  The region is also
// created and set here.
void CBalloonHelp::PositionWindow()
{
	CSize sizeWnd = CalcWindowSize();
	
	CPoint ptTail[3];
	CPoint ptTopLeft(0,0);
	CPoint ptBottomRight(sizeWnd.cx, sizeWnd.cy);
	
	// force recalculation of desktop
	m_screenRect.SetRectEmpty();
	
	switch (GetBalloonQuadrant())
	{
	case BQ_TOPLEFT:
		ptTopLeft.y = nTIP_TAIL;
		ptTail[0].x = (sizeWnd.cx-nTIP_TAIL)/4 + nTIP_TAIL;
		ptTail[0].y = nTIP_TAIL+1;
		ptTail[2].x = (sizeWnd.cx-nTIP_TAIL)/4;
		ptTail[2].y = ptTail[0].y;
		ptTail[1].x = ptTail[2].x;
		ptTail[1].y = 1;
		break;
	case BQ_TOPRIGHT:
		ptTopLeft.y = nTIP_TAIL;
		ptTail[0].x = (sizeWnd.cx-nTIP_TAIL)/4*3;
		ptTail[0].y = nTIP_TAIL+1;
		ptTail[2].x = (sizeWnd.cx-nTIP_TAIL)/4*3 + nTIP_TAIL;
		ptTail[2].y = ptTail[0].y;
		ptTail[1].x = ptTail[2].x;
		ptTail[1].y = 1;
		break;
	case BQ_BOTTOMLEFT:
		ptBottomRight.y = sizeWnd.cy-nTIP_TAIL;
		ptTail[0].x = (sizeWnd.cx-nTIP_TAIL)/4 + nTIP_TAIL;
		ptTail[0].y = sizeWnd.cy-nTIP_TAIL-2;
		ptTail[2].x = (sizeWnd.cx-nTIP_TAIL)/4;
		ptTail[2].y = ptTail[0].y;
		ptTail[1].x = ptTail[2].x;
		ptTail[1].y = sizeWnd.cy-2;
		break;
	case BQ_BOTTOMRIGHT:
		ptBottomRight.y = sizeWnd.cy-nTIP_TAIL;
		ptTail[0].x = (sizeWnd.cx-nTIP_TAIL)/4*3;
		ptTail[0].y = sizeWnd.cy-nTIP_TAIL-2;
		ptTail[2].x = (sizeWnd.cx-nTIP_TAIL)/4*3 + nTIP_TAIL;
		ptTail[2].y = ptTail[0].y;
		ptTail[1].x = ptTail[2].x;
		ptTail[1].y = sizeWnd.cy-2;
		break;
				default:
					ASSERT(FALSE);
	}
	
	// adjust for very narrow balloons
	if ( ptTail[0].x < nTIP_MARGIN )
		ptTail[0].x = nTIP_MARGIN;
	if ( ptTail[0].x > sizeWnd.cx - nTIP_MARGIN )
		ptTail[0].x = sizeWnd.cx - nTIP_MARGIN;
	if ( ptTail[1].x < nTIP_MARGIN )
		ptTail[1].x = nTIP_MARGIN;
	if ( ptTail[1].x > sizeWnd.cx - nTIP_MARGIN )
		ptTail[1].x = sizeWnd.cx - nTIP_MARGIN;
	if ( ptTail[2].x < nTIP_MARGIN )
		ptTail[2].x = nTIP_MARGIN;
	if ( ptTail[2].x > sizeWnd.cx - nTIP_MARGIN )
		ptTail[2].x = sizeWnd.cx - nTIP_MARGIN;
	
	// get window position
	CPoint ptAnchor = GetAnchorPoint();
	CPoint ptOffs(ptAnchor.x - ptTail[1].x, ptAnchor.y - ptTail[1].y);
	
	// adjust position so all is visible
	CRect rectScreen;
	GetAnchorScreenBounds(rectScreen);
	int nAdjustX = 0;
	int nAdjustY = 0;
	if ( ptOffs.x < rectScreen.left )
		nAdjustX = rectScreen.left-ptOffs.x;
	else if ( ptOffs.x + sizeWnd.cx >= rectScreen.right )
		nAdjustX = rectScreen.right - (ptOffs.x + sizeWnd.cx);
	if ( ptOffs.y + nTIP_TAIL < rectScreen.top )
		nAdjustY = rectScreen.top - (ptOffs.y + nTIP_TAIL);
	else if ( ptOffs.y + sizeWnd.cy - nTIP_TAIL >= rectScreen.bottom )
		nAdjustY = rectScreen.bottom - (ptOffs.y + sizeWnd.cy - nTIP_TAIL);
	
	// reposition tail
	// uncomment two commented lines below to move entire tail 
	// instead of just anchor point
	
	//ptTail[0].x -= nAdjustX;
	ptTail[1].x -= nAdjustX;
	//ptTail[2].x -= nAdjustX;
	ptOffs.x    += nAdjustX;
	ptOffs.y    += nAdjustY;
	
	// place window
	MoveWindow(ptOffs.x, ptOffs.y, sizeWnd.cx, sizeWnd.cy, TRUE);
	
	// apply region
	CRgn region;
	CRgn regionRound;
	CRgn regionComplete;
	region.CreatePolygonRgn(&ptTail[0], 3, ALTERNATE);
	regionRound.CreateRoundRectRgn(ptTopLeft.x,ptTopLeft.y,ptBottomRight.x,ptBottomRight.y,nTIP_MARGIN*3,nTIP_MARGIN*3);
	regionComplete.CreateRectRgn(0,0,1,1);
	regionComplete.CombineRgn(&region, &regionRound, RGN_OR);
	
	if ( NULL == m_rgnComplete.m_hObject )
		m_rgnComplete.CreateRectRgn(0,0,1,1);
	
	if ( !m_rgnComplete.EqualRgn(&regionComplete) )
	{
		m_rgnComplete.CopyRgn(&regionComplete);
		SetWindowRgn((HRGN)regionComplete.Detach(), TRUE);
		
		// There is a bug with layered windows and NC changes in Win2k
		// As a workaround, redraw the entire window if the NC area changed.
		// Changing the anchor point is the ONLY thing that will change the
		// position of the client area relative to the window during normal
		// operation.
		RedrawWindow(NULL, NULL, RDW_UPDATENOW| RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
	}
}