当前位置: 首页>>代码示例>>C++>>正文


C++ SetWindowRgn函数代码示例

本文整理汇总了C++中SetWindowRgn函数的典型用法代码示例。如果您正苦于以下问题:C++ SetWindowRgn函数的具体用法?C++ SetWindowRgn怎么用?C++ SetWindowRgn使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetWindowRgn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetWindowRect

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());
	}
}
开发者ID:15375514460,项目名称:TortoiseGit,代码行数:25,代码来源:ResizableGrip.cpp

示例2: ModifyStyle

void CRoundButton::PreSubclassWindow() 
{
	CButton::PreSubclassWindow();

	ModifyStyle(0, BS_OWNERDRAW);

	CRect rect;
	GetClientRect(rect);

	// Resize the window to make it square
	rect.bottom = rect.right = min(rect.bottom,rect.right);

	// Get the vital statistics of the window
	m_ptCentre = rect.CenterPoint();
	m_nRadius  = rect.bottom/2-1;

	// Set the window region so mouse clicks only activate the round section 
	// of the button
	m_rgn.DeleteObject(); 
	SetWindowRgn(NULL, FALSE);
	m_rgn.CreateEllipticRgnIndirect(rect);
	SetWindowRgn(m_rgn, TRUE);

	// Convert client coords to the parents client coords
	ClientToScreen(rect);
	CWnd* pParent = GetParent();
	if (pParent) pParent->ScreenToClient(rect);

	// Resize the window
	MoveWindow(rect.left, rect.top, rect.Width(), rect.Height(), TRUE);
}
开发者ID:hackshields,项目名称:antivirus,代码行数:31,代码来源:RoundButton.cpp

示例3: SetWindowRgn

void CXTPPopupControl::UpdateBitmapRegion()
{
	if (!GetSafeHwnd())
		return;

	m_bLayered = FALSE;

	if (m_nBackgroundBitmap <= 0)
	{
		SetWindowRgn(NULL, FALSE);
		return;
	}

	CXTPImageManagerIcon* pImage = m_pImageManager->GetImage(m_nBackgroundBitmap, 0);
	if (!pImage)
	{
		SetWindowRgn(NULL, FALSE);
		return;
	}

	if (pImage->IsAlpha())
	{
		SetWindowRgn(NULL, FALSE);

		SetRegionAlphaLayer(pImage);
	}
	else
	{
		HRGN hRgn = BitmapToRegion(pImage);
		if (!hRgn)
			return;

		SetWindowRgn(hRgn, FALSE);
	}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:35,代码来源:XTPPopupControl.cpp

示例4: CreateRectRgn

	void D3D9RenderWindow::_finishSwitchingFullscreen()
	{		
		if(mIsFullScreen)
		{
			// Need to reset the region on the window sometimes, when the 
			// windowed mode was constrained by desktop 
			HRGN hRgn = CreateRectRgn(0,0,mWidth, mHeight);
			SetWindowRgn(mHWnd, hRgn, FALSE);
		}
		else
		{			
			// When switching back to windowed mode, need to reset window size 
			// after device has been restored
			// We may have had a resize event which polluted our desired sizes
			if (mWidth != mDesiredWidth ||
				mHeight != mDesiredHeight)
			{
				mWidth = mDesiredWidth;
				mHeight = mDesiredHeight;				
			}
			unsigned int winWidth, winHeight;
			adjustWindow(mWidth, mHeight, &winWidth, &winHeight);

			// deal with centering when switching down to smaller resolution
			HMONITOR hMonitor = MonitorFromWindow(mHWnd, MONITOR_DEFAULTTONEAREST);
			MONITORINFO monitorInfo;
			memset(&monitorInfo, 0, sizeof(MONITORINFO));
			monitorInfo.cbSize = sizeof(MONITORINFO);
			GetMonitorInfo(hMonitor, &monitorInfo);

			LONG screenw = monitorInfo.rcWork.right  - monitorInfo.rcWork.left;
			LONG screenh = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top;

            // When switching from a low fullscreen res to windowed mode in a high
            // res desktop need to release this low res constraint on the window
            // region otherwise we will not be able to make the window larger
            // than the low fullscreen res we were just at
            SetWindowRgn(mHWnd, NULL, TRUE);

			int left = screenw > winWidth ? ((screenw - winWidth) / 2) : 0;
			int top = screenh > winHeight ? ((screenh - winHeight) / 2) : 0;
			SetWindowPos(mHWnd, HWND_NOTOPMOST, left, top, winWidth, winHeight,
				SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOACTIVATE);

			updateWindowRect();
		}
		mSwitchingFullscreen = false;
	}
开发者ID:monwarez-grit,项目名称:grit-ogre,代码行数:48,代码来源:OgreD3D9RenderWindow.cpp

示例5: AvatarTrackBarWndProc

LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	if (!IsWindowEnabled(hwnd))
		return mir_callNextSubclass(hwnd, AvatarTrackBarWndProc, msg, wParam, lParam);

	static int oldVal = -1;
	switch (msg) {
	case WM_MOUSEWHEEL:
	case WM_KEYDOWN:
	case WM_KEYUP:
		if (!IsWindowVisible(hwndBox))
			break;

	case WM_MOUSEMOVE:
		{
			TRACKMOUSEEVENT tme;
			tme.cbSize = sizeof(tme);
			tme.dwFlags = TME_LEAVE;
			tme.dwHoverTime = HOVER_DEFAULT;
			tme.hwndTrack = hwnd;
			_TrackMouseEvent(&tme);

			int newVal = (BYTE)SendMessage(hwnd, TBM_GETPOS, 0, 0);
			if (oldVal != newVal) {
				if (oldVal < 0)
					SetWindowLongPtr(hwndBox, GWLP_USERDATA, 0);

				RECT rc; GetWindowRect(hwnd, &rc);
				SetWindowPos(hwndBox, NULL,
					(rc.left+rc.right-newVal)/2, rc.bottom+2, newVal, newVal,
					SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW);

				HRGN rgn = CreateRoundRectRgn(0, 0, newVal, newVal, 2 * PopupOptions.avatarRadius, 2 * PopupOptions.avatarRadius);
				SetWindowRgn(hwndBox, rgn, TRUE);
				InvalidateRect(hwndBox, NULL, FALSE);
				oldVal = newVal;
			}
		}
		break;

	case WM_MOUSELEAVE:
		SetWindowRgn(hwndBox, NULL, TRUE);
		ShowWindow(hwndBox, SW_HIDE);
		oldVal = -1;
		break;
	}
	return mir_callNextSubclass(hwnd, AvatarTrackBarWndProc, msg, wParam, lParam);
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:48,代码来源:opt_adv.cpp

示例6: CrearVentana

const BOOL VentanaDump::Mostrar(const TCHAR *PathDump) { 
	
	
	
	_PathDump = PathDump;
	UINT YC = 6;
	if (Sistema.App.Config.UtilizarBarraTituloWindows == true) { 
		CrearVentana(0, TEXT("BubaTronik_VentanaDump"), WS_OVERLAPPED | WS_SYSMENU, IDIOMA__ERROR_GRAVE, DWL_CENTRADO, DWL_CENTRADO, 547, 150, 0);
		YC = 80;
	}
	else {
		CrearVentana(0, TEXT("BubaTronik_VentanaDump"), WS_POPUP, IDIOMA__ERROR_GRAVE, DWL_CENTRADO, DWL_CENTRADO, 543, 145, 0);
		HRGN Region = CreateRoundRectRgn(0, 0, 544, 146, 11, 11);
		SetWindowRgn(_hWnd, Region, false);
		YC = 100;
	}
	if (_hWnd == NULL) return FALSE;
	_Barra.CrearBarraEx(WS_CHILD | WS_VISIBLE, _hWnd, 10, YC, 522, 8, ID_BARRA_DUMP, DWL_BARRAEX_PROGRESO_HORIZONTAL, 0, 1000);
	_BotonGuardar.CrearBotonEx(WS_CHILD | WS_VISIBLE, _hWnd, IDIOMA__ENVIAR, 196, YC + 13, 70, 20, 101);
	_BotonTerminar.CrearBotonEx(WS_CHILD | WS_VISIBLE, _hWnd, IDIOMA__TERMINAR, 276, YC + 13, 70, 20, 100);

	Visible(true);
	_BotonGuardar.AsignarFoco();
	return TRUE;
};
开发者ID:devildrey33,项目名称:BubaTronik,代码行数:25,代码来源:VentanaDump.cpp

示例7: w

void Fl_Shaped_Window::draw()
{
    if ((lw != w() || lh != h() || changed) && shape_)
    {
        // size of window has change since last time
        lw = w(); lh = h();
        Fl_Bitmap* mask = resize_bitmap(shape_, w(), h());
#ifdef _WIN32
        HRGN region = bitmap2region(mask);
        SetWindowRgn(fl_xid(this), region, TRUE);
#elif defined(__APPLE__)
        // not yet implemented for Apple
#else
        Pixmap pmask = XCreateBitmapFromData(fl_display, fl_xid(this),
                                             (const char*)mask->data(), mask->width(), mask->height());
        hide();
        XShapeCombineMask(fl_display, fl_xid(this), ShapeBounding, 0, 0,
                          pmask, ShapeSet);
        show();
        if (pmask != None) XFreePixmap(fl_display, pmask);
#endif
        changed = 0;
    }
    Fl_Double_Window::draw();
}
开发者ID:edeproject,项目名称:svn,代码行数:25,代码来源:Fl_Shaped_Window.cpp

示例8: OnSize

void CChildWnd::OnSkinChange()
{
	m_pSkin = Skin.GetWindowSkin( this );
	OnSize( 0, 0, 0 );

	// ToDo: Remove this mode?
	CoolInterface.EnableTheme( this, ( m_pSkin == NULL ) &&
		( Settings.General.GUIMode == GUI_WINDOWED ) );

	if ( m_nResID )
	{
		CoolInterface.SetIcon( m_nResID, Settings.General.LanguageRTL, FALSE, this );

		CString strCaption;
		LoadString( strCaption, m_nResID );

		SetWindowText( _T("") );
		SetWindowText( strCaption );
	}

	if ( m_bAlert != 1982 )
	{
		SetWindowRgn( NULL, FALSE );
		SetWindowPos( NULL, 0, 0, 0, 0,
			SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_FRAMECHANGED );
		if ( m_pSkin ) m_pSkin->OnSize( this );
	}
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:28,代码来源:WndChild.cpp

示例9: f

void CDlgLeftShow::LoadSkin()
{
	TCHAR		path[MAX_PATH];
	CString		s = "..\\";
	CBcfFile f( s + "..\\" + m_skinmgr.GetGameSkinPath() + m_skinmgr.GetGameSkinBcfFileName());
	CString SkinFolder	= f.GetKeyVal("config", "skinfolder", m_skinmgr.GetSkinPath());
	wsprintf(path, "%s%sgame\\SomeOneLeft.bmp", s, SkinFolder);

	int cx,cy;
	CGameImage	m_bt;
	m_bt.SetLoadInfo(path,true);
	m_bkimage.SetLoadInfo(path,CGameImageLink::m_bAutoLock);
	CGameImageHelper ImageHandle(&m_bkimage);
	HRGN hRgn=AFCBmpToRgn(ImageHandle,m_bkimage.GetPixel(0,0),RGB(1,1,1));
	if (hRgn!=NULL)
	{
		SetWindowRgn(hRgn,TRUE);
	}
	//cx=ImageHandle.GetWidth();
	//cy=ImageHandle.GetHeight();
	//SetWindowPos(NULL,0,0,cx,cy,SWP_NOMOVE|SWP_NOZORDER);
	//CenterWindow(m_pParentWnd);

	wsprintf(path, "%s%sgame\\ok_bt.bmp", s, SkinFolder);

	m_bt.SetLoadInfo(path,true);
	m_btOk.LoadButtonBitmap(path,false);
	//m_btOk.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER);
	//m_btOk.MoveWindow( (m_bkimage.GetWidth() - m_bt.GetWidth()/4)/2,
		//m_bkimage.GetHeight()-50,
		//m_bt.GetWidth()/4,
		//m_bt.GetHeight()
		//);
}
开发者ID:lincoln56,项目名称:robinerp,代码行数:34,代码来源:DlgLeftShow.cpp

示例10: GetObject

BOOL CBubleWnd::SetSkin(LPCTSTR szFileName,short red,short green,short blue)
{
	BITMAP bm;
	HBITMAP hBmp;

	hBmp=(HBITMAP) ::LoadImage(AfxGetInstanceHandle(),szFileName,IMAGE_BITMAP,0,0, LR_LOADFROMFILE);
	if (!hBmp)
		return FALSE;

	m_biSkinBackground.DeleteObject();
	m_biSkinBackground.Attach(hBmp);
	GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
	m_nSkinWidth=bm.bmWidth;
	m_nSkinHeight=bm.bmHeight;
	m_rcText.SetRect(0,0,bm.bmWidth,bm.bmHeight);

	if (red!=-1 && green!=-1 && blue!=-1)
	{
		// No need to delete the HRGN,  SetWindowRgn() owns it after being called
		m_hSkinRegion=GenerateRegion((HBITMAP)m_biSkinBackground.GetSafeHandle(),(BYTE) red,(BYTE) green,(BYTE) blue);
		SetWindowRgn(m_hSkinRegion, true);
	}

	return TRUE;
}
开发者ID:yedushusheng,项目名称:FireBirdTool,代码行数:25,代码来源:BubleWnd.cpp

示例11: GetObject

BOOL CTaskbarNotifier::SetBitmap(LPCTSTR szFileName, int red, int green, int blue)
{
	if (szFileName==NULL || szFileName[0]==_T('\0'))
		return FALSE;
	HBITMAP hBmp = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),szFileName,IMAGE_BITMAP,0,0, LR_LOADFROMFILE);
	if (!hBmp)
		return FALSE;

	m_bitmapBackground.DeleteObject();
	m_bitmapBackground.Attach(hBmp);

	BITMAP bm;
	GetObject(m_bitmapBackground.GetSafeHandle(), sizeof(bm), &bm);
	m_nBitmapWidth = bm.bmWidth;
	m_nBitmapHeight = bm.bmHeight;

	if (red!=-1 && green!=-1 && blue!=-1)
	{
		// No need to delete the HRGN,	SetWindowRgn() owns it after being called
		m_hBitmapRegion=CreateRgnFromBitmap((HBITMAP)m_bitmapBackground.GetSafeHandle(),RGB(red,green,blue));
		SetWindowRgn(m_hBitmapRegion, true);
	}

	return TRUE;
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:25,代码来源:TaskbarNotifier.cpp

示例12: BitmapToRegion

void CAnimateButton::PrepareBitmap(HBITMAP hBitmap)
{
	int nStates = 4;

	//取得图像所处区域及计算各状态按钮窗口区域
	m_arBmpRgn.SetSize(nStates);
	m_arBmpRgn.SetSize(nStates);

	CRect rcTmp;
	for(int i = 0; i < nStates; i ++)
	{
		m_arBmpRgn[i] = BitmapToRegion(hBitmap, nStates, i);
	}

	CBitmap* pBmpWhole = CBitmap::FromHandle(hBitmap);
	BITMAP bmp;
	pBmpWhole->GetBitmap(&bmp);

	m_aniBtnWidth = bmp.bmWidth / nStates;
	m_aniBtnHeight = bmp.bmHeight;

	m_pMemDC = new CDC;
	CDC* pDC = GetDC();
	m_pMemDC->CreateCompatibleDC(pDC);
	m_pMemDC->SelectObject(pBmpWhole);
	ReleaseDC(pDC);

 	CRgn RgnWnd;
 	RgnWnd.CreateRectRgn(0, 0, m_aniBtnWidth, m_aniBtnHeight);
 	SetWindowRgn(HRGN(RgnWnd), FALSE);
	//调整大小(这样在DrawItem里面才可能限定画的范围)
	SetWindowPos(NULL, 0, 0, m_aniBtnWidth, m_aniBtnHeight, SWP_NOMOVE);
}
开发者ID:latelan,项目名称:BlueClick,代码行数:33,代码来源:AnimateButton.cpp

示例13: Default

void CSkinButton::OnPaint() 
{
	if ( !m_res || !m_res->m_bInited )
	{
		Default();
		return;
	}
	//Note:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	// to draw button, cliprgn is needed
	//
	CPaintDC dc(this); // device context for painting
	CRect r;
	CMyBitmap bmp;
	GetClientRect(r);
	DrawImage(bmp);
	SetWindowRgn(bmp.CreateRgnFromFile(RGB(255,0,255)), TRUE );

	
	HRGN hRgn = CreateRectRgn(0, 0, 0, 0);
	GetWindowRgn(hRgn);				
	::SelectClipRgn(dc.GetSafeHdc(), hRgn);
	bmp.Draw( &dc, r );	
	dc.SelectClipRgn(NULL);
	DeleteObject(hRgn);
	
	//dc.BitBlt( 0, 0, r.Width(), r.Height(), &memDC, 0, 0, SRCCOPY);
	DrawText( &dc );

	// TODO: Add your message handler code here
	// Do not call CButton::OnPaint() for painting messages
}
开发者ID:mikesimb,项目名称:SkinDemo2,代码行数:31,代码来源:SkinButton.cpp

示例14: GetClientRect

void CFileAskDlg::SetDlgReign()
{
	int UI_ROUNDRECT_WIDTH = 16;
	int UI_ROUNDRECT_HEIGHT = 16;

	CRect rc;
	POINT Points[6];
	GetClientRect(&rc);

	HRGN rgn1 = CreateRoundRectRgn(0, 0, rc.Width() / 2, rc.Height() / 2, UI_ROUNDRECT_WIDTH, UI_ROUNDRECT_HEIGHT);
	Points[0].x = 0;
	Points[0].y = UI_ROUNDRECT_HEIGHT;
	Points[1].x = 0;
	Points[1].y = rc.Height() + UI_ROUNDRECT_HEIGHT;
	Points[2].x = rc.Width() + UI_ROUNDRECT_WIDTH;
	Points[2].y = rc.Height() + UI_ROUNDRECT_HEIGHT;
	Points[3].x = rc.Width() + UI_ROUNDRECT_WIDTH;
	Points[3].y = 0;
	Points[4].x = UI_ROUNDRECT_WIDTH;
	Points[4].y = 0;
	Points[5].x = UI_ROUNDRECT_WIDTH;
	Points[5].y = UI_ROUNDRECT_HEIGHT;
	HRGN rgn2 = CreatePolygonRgn(Points, 6, ALTERNATE);
	CombineRgn(rgn1, rgn1, rgn2, RGN_OR);
	SetWindowRgn(rgn1, TRUE);

	DeleteObject(rgn2);
}
开发者ID:uvbs,项目名称:myhistoryprojects,代码行数:28,代码来源:FileAskDlg.cpp

示例15: Win32_SetWindowShape

int
Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
    SDL_ShapeData *data;
    HRGN mask_region = NULL;

    if( (shaper == NULL) ||
        (shape == NULL) ||
        ((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey)) ||
        (shape->w != shaper->window->w) ||
        (shape->h != shaper->window->h) ) {
        return SDL_INVALID_SHAPE_ARGUMENT;
    }

    data = (SDL_ShapeData*)shaper->driverdata;
    if(data->mask_tree != NULL)
        SDL_FreeShapeTree(&data->mask_tree);
    data->mask_tree = SDL_CalculateShapeTree(*shape_mode,shape);

    SDL_TraverseShapeTree(data->mask_tree,&CombineRectRegions,&mask_region);
    SDL_assert(mask_region != NULL);

    SetWindowRgn(((SDL_WindowData *)(shaper->window->driverdata))->hwnd, mask_region, TRUE);

    return 0;
}
开发者ID:Daft-Freak,项目名称:vogl,代码行数:25,代码来源:SDL_windowsshape.c


注:本文中的SetWindowRgn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。