コード例 #1
0
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());
	}
}
コード例 #2
0
ファイル: RoundButton.cpp プロジェクト: hackshields/antivirus
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);
}
コード例 #3
0
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);
	}
}
コード例 #4
0
	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;
	}
コード例 #5
0
ファイル: opt_adv.cpp プロジェクト: MrtsComputers/miranda-ng
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);
}
コード例 #6
0
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;
};
コード例 #7
0
ファイル: Fl_Shaped_Window.cpp プロジェクト: edeproject/svn
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();
}
コード例 #8
0
ファイル: WndChild.cpp プロジェクト: lemonxiao0/peerproject
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 );
	}
}
コード例 #9
0
ファイル: DlgLeftShow.cpp プロジェクト: lincoln56/robinerp
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()
		//);
}
コード例 #10
0
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;
}
コード例 #11
0
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;
}
コード例 #12
0
ファイル: AnimateButton.cpp プロジェクト: latelan/BlueClick
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);
}
コード例 #13
0
ファイル: SkinButton.cpp プロジェクト: mikesimb/SkinDemo2
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
}
コード例 #14
0
ファイル: FileAskDlg.cpp プロジェクト: uvbs/myhistoryprojects
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);
}
コード例 #15
0
ファイル: SDL_windowsshape.c プロジェクト: Daft-Freak/vogl
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;
}
コード例 #16
0
int CMovingLrcDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO:  在此添加您专用的创建代码
	MoveWindow(CRect(400,0,800,25));
	SetTimer(1,TIMER_INTERVAL,NULL);
	ipast=0.0f;
	m_Font.CreateFont(   
		12,    //nHeight   //_T("Tahoma")); 14
		0,                              //nWidth   
		0,    //nEscapement   
		0,    //nOrientation   
		FW_NORMAL,   //nWeight 
		//FW_MEDIUM,
		//FW_SEMIBOLD,
		FALSE,                          //bItalic   
		FALSE,                          //bUnderline   
		0,                              //cStrikeOut   
		//   ANSI_CHARSET,     
		DEFAULT_CHARSET,  //nCharSet   
		OUT_DEFAULT_PRECIS,             //nOutPrecision   
		CLIP_DEFAULT_PRECIS,            //nClipPrecision   
		DEFAULT_QUALITY,                //nQuality   
		DEFAULT_PITCH   |   FF_SWISS,   //nPitchAndFamily   
		_T("宋体"));
	SetWindowPos(&wndTopMost,400,0,0,0,SWP_NOSIZE);
	CRgn rgn;
	rgn.CreateRoundRectRgn(0,0,400,25,10,10);
	SetWindowRgn(rgn,TRUE);
	ShowWindow(SW_SHOW);
	UpdateWindow();
	return 0;
}
コード例 #17
0
ファイル: GameFinishdlg.cpp プロジェクト: lincoln56/robinerp
int CGameFinishDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  在此添加您专用的创建代码
	TCHAR szName[MAX_PATH];
	wsprintf(szName,TEXT(".\\image\\result.bmp"));
	m_bk.SetLoadInfo(szName,TRUE);

	wsprintf(szName,".\\image\\win.bmp");
	m_Flag.SetLoadInfo(szName,false);

	CRect ClientRect;
	GetClientRect(&ClientRect);
	//this->MapWindowPoints(this->GetParent(),&ClientRect);
	CGameImageHelper	help(&m_bk);
	this->MoveWindow(ClientRect.left,ClientRect.top,help.GetWidth(),help.GetHeight());
	HRGN hRgn=AFCBmpToRgn(help,RGB(255,0,255),RGB(1,0,1));
	if (hRgn!=NULL)
	{
		SetWindowPos(NULL,0,0,help.GetWidth(),help.GetHeight(),SWP_NOMOVE);
		SetWindowRgn(hRgn,TRUE);
	}

	return 0;
}
コード例 #18
0
ファイル: osmdichildwnd.cpp プロジェクト: bizzehdee/wasabi
void OSMDIChildWnd::setWindowFlags() {
  #ifdef WIN32
  SetWindowLong(gethWnd(), GWL_STYLE, WS_CHILDWINDOW | WS_OVERLAPPED | WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | (isVisible(1) ? WS_VISIBLE : 0));
  SetWindowLong(gethWnd(), GWL_EXSTYLE, WS_EX_MDICHILD | WS_EX_WINDOWEDGE);
  SetWindowRgn(gethWnd(), NULL, TRUE);
  #endif
}
コード例 #19
0
ファイル: bmpclock.c プロジェクト: turmary/smalls
void Init(void) {
	HRGN TSt;
	HBITMAP hBmpBack, hBmpCircle;

	hMenu = CreatePopupMenu();
	AppendMenu (hMenu,0,IDM_BACK1, szMenuBack1);
	AppendMenu (hMenu,0,IDM_BACK2, szMenuBack2);
	AppendMenu (hMenu,MF_SEPARATOR,0,NULL);
	AppendMenu (hMenu,0,IDM_CIRCLE1, szMenuCircle1);
	AppendMenu (hMenu,0,IDM_CIRCLE2, szMenuCircle2);
	AppendMenu (hMenu,MF_SEPARATOR,0,NULL);
	AppendMenu (hMenu,0,IDM_EXIT, szMenuExit);
	CheckMenuRadioItem (hMenu,IDM_BACK1,IDM_BACK2,IDM_BACK1,0);
	CheckMenuRadioItem (hMenu,IDM_CIRCLE1,IDM_CIRCLE2,IDM_CIRCLE1,0);

	TSt = CreateEllipticRgn (0,0,CLOCK_SIZE+1,CLOCK_SIZE+1);
	SetWindowRgn (hWinMain, TSt, TRUE);
	DeleteObject (TSt);
	SetWindowPos (hWinMain, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

	dwNowBack = IDB_BACK1;
	dwNowCircle = IDB_CIRCLE1;
	CreateBackGround();
	CreateClockPic();
	SetTimer (hWinMain, ID_TIMER, 1000, NULL);
	return;
}
コード例 #20
0
ファイル: dbframe.cpp プロジェクト: tianyx/TxUIProject
void CDBFrame::OnSetWndRgn()
{
	/*
	//创建凸出的部分区域
	CRgn rgnAdd;
	CRect rcRgnAdd;
	GetTitleRect(rcRgnAdd);
	rcRgnAdd.bottom = rcRgnAdd.top + 3;
	rgnAdd.CreateRectRgnIndirect(rcRgnAdd);
	*/

	CRect rcRgn;
	GetWindowRect(&rcRgn);
	rcRgn.OffsetRect(-rcRgn.left, -rcRgn.top);
	rcRgn.top;
	m_rgnWnd.DeleteObject();
	m_rgnWnd.CreateRoundRectRgn(rcRgn.left, rcRgn.top, rcRgn.right,
		rcRgn.bottom, m_szRoundCorner.cx, m_szRoundCorner.cy);
	
	/*
	//合并区域
	m_rgnWnd.CombineRgn(&m_rgnWnd, &rgnAdd, RGN_OR);
	*/

	SetWindowRgn(m_rgnWnd, TRUE);

}
コード例 #21
0
void CEasySkinManager::OnSize( UINT nType, int cx, int cy )
{
    CEasySkinDialog::OnSize(nType, cx, cy);

    //移动准备
    HDWP hDwp=BeginDeferWindowPos(64);
    UINT uFlags=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER;

    if ( m_enWndStyle != en_Wnd_None )
    {
        DeferWindowPos(hDwp,m_btClose,NULL,cx-41,0,0,0,uFlags|SWP_NOSIZE);

        if ( m_enWndStyle != en_Wnd_CloseBox )
        {
            if( m_enWndStyle != en_Wnd_MinimizeBox )
                DeferWindowPos(hDwp,m_btMax,NULL,cx-69,0,0,0,uFlags|SWP_NOSIZE);

            DeferWindowPos(hDwp,m_btMin,NULL,cx-69-(m_enWndStyle==en_Wnd_Normal?28:0),0,0,0,uFlags|SWP_NOSIZE);
        }
    }

    //结束调整
    //LockWindowUpdate();
    EndDeferWindowPos(hDwp);
    //UnlockWindowUpdate();

    //设置圆角
    CRgn rgn;
    rgn.CreateRoundRectRgn(0,0,cx,cy,4,4);
    SetWindowRgn(rgn,FALSE);

    //更新界面
    Invalidate(FALSE);
}
コード例 #22
0
BOOL OnCalendarInitDialog(HWND hwndDlg, HWND hwndFocus, LPARAM lParam)
{
	//Initialize common controls
	INITCOMMONCONTROLSEX InitCtrlEx;
	HRGN hRgn;RECT rRect;
	InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
	InitCtrlEx.dwICC  =  ICC_BAR_CLASSES;
	InitCommonControlsEx(&InitCtrlEx);
	GetLocalTime (&sCurrentDay);		
	GetClientRect(hwndDlg,&rRect);
	//GetWindowRect(hwndDlg,&rRect);
	rRect.left+=GetSystemMetrics(SM_CXDLGFRAME);
	rRect.top+=GetSystemMetrics(SM_CYSIZE)+GetSystemMetrics(SM_CYDLGFRAME);
	rRect.right+=GetSystemMetrics(SM_CXDLGFRAME);
	rRect.bottom+=GetSystemMetrics(SM_CYSIZE)+GetSystemMetrics(SM_CYDLGFRAME);

	hRgn=CreateRoundRectRgn(rRect.left,rRect.top,rRect.right,rRect.bottom,20,20);
	SetWindowRgn(hwndDlg,hRgn,TRUE);
	DeleteObject(hRgn);

	hPopUpMenu=LoadMenu(g_hInstance,MAKEINTRESOURCE(IDR_CalendarMenu));

	hOldProc=(WNDPROC)SetWindowLong(GetDlgItem(hwndDlg,IDC_Calendar),GWL_WNDPROC,(LONG)SubClassProc); 

	rDateRects=new RECT[33];

	hToolTipWindow= CreateWindowEx(WS_EX_TRANSPARENT, TOOLTIPS_CLASS, NULL,WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT,hwndDlg, NULL, g_hInstance,NULL);
	SetWindowPos(hToolTipWindow, HWND_TOPMOST,0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
	return TRUE;
}
コード例 #23
0
	//---------------------------------------------------------------------
	void D3D10RenderWindow::_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,md3dpp.BufferDesc.Width, md3dpp.BufferDesc.Height);
			SetWindowRgn(mHWnd, hRgn, FALSE);
		}
		else
		{
			// When switching back to windowed mode, need to reset window size 
			// after device has been restored
			RECT rc;
			SetRect(&rc, 0, 0, md3dpp.BufferDesc.Width, md3dpp.BufferDesc.Height);
			AdjustWindowRect(&rc, GetWindowLong(mHWnd, GWL_STYLE), false);
			unsigned int winWidth = rc.right - rc.left;
			unsigned int winHeight = rc.bottom - rc.top;
			int screenw = GetSystemMetrics(SM_CXSCREEN);
			int screenh = GetSystemMetrics(SM_CYSCREEN);
			int left = (screenw - winWidth) / 2;
			int top = (screenh - winHeight) / 2;
			SetWindowPos(mHWnd, HWND_NOTOPMOST, left, top, winWidth, winHeight,
				SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOACTIVATE);

		}
		mpSwapChain->SetFullscreenState(mIsFullScreen, NULL);
		mSwitchingFullscreen = false;
	}
コード例 #24
0
ファイル: SVPDialog.cpp プロジェクト: Strongc/playasa
void CSVPDialog::OnSize(UINT nType, int cx, int cy)
{
	CWnd::OnSize(nType, cx, cy);

	CRect r,cr;

	{ //New UI
		CRect rc;
		GetWindowRect(&rc);
		rc-=rc.TopLeft();



		// destroy old region
		if((HRGN)m_rgn)
		{
			m_rgn.DeleteObject();
		}

		m_rgn.CreateRoundRectRgn(0,0,rc.Width()-1,rc.Height()-1, 3,3);                 // rounded rect w/50 pixel corners

		m_rgnBorder.CreateRoundRectRgn(1,1,rc.Width()-2,rc.Height()-2, 3,3);            

		SetWindowRgn(m_rgn,TRUE);

		m_btnClose.MoveWindow( rc.right-16,rc.top+3, 12, 12);
	}

	
}
コード例 #25
0
ファイル: SkinButton.cpp プロジェクト: mikesimb/SkinDemo2
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;
}
コード例 #26
0
ファイル: SkinBtn.cpp プロジェクト: alucard263096/AMK
BOOL CSkinBtn::OnEraseBkgnd(CDC* pDC)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	if(m_bRePain == FALSE)
	{
		if(!m_bDCStored)
		{
    		CRect  rect;
			GetClientRect(&rect);

			m_memDC.CreateCompatibleDC (pDC);
			CBitmap	btScreen;
			btScreen.CreateCompatibleBitmap (pDC,rect.Width(),rect.Height());
			m_memDC.SelectObject (&btScreen);

			m_memDC.BitBlt (0,0,rect.Width(),rect.Height(),pDC,0,0,SRCCOPY);

			m_bDCStored=true;

			CRgn rgn;
			rgn.CreateRectRgn (0, 0, rect.Width(), rect.Height());
			SetWindowRgn (rgn, TRUE);

			btScreen.DeleteObject();
		}
	}
	return TRUE;// CButton::OnEraseBkgnd(pDC);//
}
コード例 #27
0
void CWidgetSplitter::DrawSplitterBar(CDCHandle dc)
{
TRY_CATCH

	RECT rect;
	if ( GetSplitterBarRect(&rect) )
	{
		RECT rc;
		GetClientRect(&rc);
		HRGN rgnWnd = CreateRectRgnIndirect(&rc);
		HRGN rgnBar = CreateRectRgnIndirect(&rect);
		CombineRgn(rgnWnd,rgnWnd,rgnBar,RGN_XOR);

		rc = rect;
		rc.left = rect.left + (rect.right - rect.left)/2;
		rc.right = rc.left + 1;

		HRGN rgnLine = CreateRectRgnIndirect(&rc);
		CombineRgn(rgnWnd,rgnWnd,rgnLine,RGN_OR);

		SetWindowRgn(rgnWnd,TRUE);

		DeleteObject(rgnBar);
		DeleteObject(rgnLine);
		DeleteObject(rgnWnd);

		dc.MoveTo(rc.left,rc.top);
		dc.LineTo(rc.left,rc.bottom);
	}

CATCH_THROW()
}
コード例 #28
0
ファイル: SkinButton.cpp プロジェクト: 275958081/netfox
//创建区域
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,32);
		ImageHandle->BitBlt(BufferImage.GetDC(),0,0,nButtonWidth,nButtomHeight,0,0);
		BufferImage.ReleaseDC();

		//创建区域
		HRGN hRgn=BufferImage.CreateImageRegion(crTrans);
		if (hRgn!=NULL)
		{
			m_crTrans=crTrans;
			SetWindowPos(NULL,0,0,nButtonWidth,nButtomHeight,SWP_NOMOVE);
			SetWindowRgn(hRgn,TRUE);
			m_ButtonRgn.DeleteObject();
			m_ButtonRgn.Attach(hRgn);
			return true;
		}
	}

	return false;
}
コード例 #29
0
BOOL CSplashScreenEx::SetBitmap(UINT nBitmapID,short red,short green,short blue)
{
    BITMAP bm;

    m_bitmap.DeleteObject();
    if (!m_bitmap.LoadBitmap(nBitmapID))
        return FALSE;

    GetObject(m_bitmap.GetSafeHandle(), sizeof(bm), &bm);
    m_nBitmapWidth=bm.bmWidth;
    m_nBitmapHeight=bm.bmHeight;
    m_rcText.SetRect(0,0,bm.bmWidth,bm.bmHeight);

    if (m_dwStyle & CSS_CENTERSCREEN)
    {
        m_nxPos=(GetSystemMetrics(SM_CXFULLSCREEN)-bm.bmWidth)/2;
        m_nyPos=(GetSystemMetrics(SM_CYFULLSCREEN)-bm.bmHeight)/2;
    }
    else if (m_dwStyle & CSS_CENTERAPP)
    {
        CRect rcParentWindow;
        ASSERT(m_pWndParent!=NULL);
        m_pWndParent->GetWindowRect(&rcParentWindow);
        m_nxPos=rcParentWindow.left+(rcParentWindow.right-rcParentWindow.left-bm.bmWidth)/2;
        m_nyPos=rcParentWindow.top+(rcParentWindow.bottom-rcParentWindow.top-bm.bmHeight)/2;
    }

    if (red!=-1 && green!=-1 && blue!=-1)
    {
        m_hRegion=CreateRgnFromBitmap((HBITMAP)m_bitmap.GetSafeHandle(),RGB(red,green,blue));
        SetWindowRgn(m_hRegion, TRUE);
    }

    return TRUE;
}
コード例 #30
0
ファイル: SplashScreen.cpp プロジェクト: ScArL3T/Pong
bool SplashScreen::setTransparent(HWND hWnd, const sf::Image& image, unsigned char alpha)
{
	const sf::Uint8* pixelData = image.getPixelsPtr();
	HRGN hRegion = CreateRectRgn(0, 0, image.getSize().x, image.getSize().y);

	// Determine the visible region
	for (unsigned int y = 0; y < image.getSize().y; y++)
	{
		for (unsigned int x = 0; x < image.getSize().x; x++)
		{
			if (pixelData[y * image.getSize().x * 4 + x * 4 + 3] == 0)
			{
				HRGN hRegionDest = CreateRectRgn(0, 0, 1, 1);
				HRGN hRegionPixel = CreateRectRgn(x, y, x + 1, y + 1);
				CombineRgn(hRegionDest, hRegion, hRegionPixel, RGN_XOR);
				DeleteObject(hRegion);
				DeleteObject(hRegionPixel);
				hRegion = hRegionDest;
			}
		}
	}

	SetWindowRgn(hWnd, hRegion, true);
	DeleteObject(hRegion);

	// Set the transparency
	SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
	SetLayeredWindowAttributes(hWnd, 0, alpha, LWA_ALPHA);
	return true;
}