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


C++ ValidateRect函数代码示例

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


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

示例1: GetClientRect

void mxBitmapButton::redraw()
{
	HWND wnd = (HWND)getHandle();
	if ( !wnd )
		return;

	if ( !m_bmImage.valid )
		return;

	RECT rc;
	GetClientRect( wnd, &rc );
	
	HDC dc = GetDC( wnd );

	DrawBitmapToDC( dc, 0, 0, w(), h(), m_bmImage );

	ReleaseDC( wnd, dc );

	ValidateRect( wnd, &rc );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:20,代码来源:mxbitmapbutton.cpp

示例2: WndProc

//消息处理函数
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_PAINT:
		ValidateRect(hwnd, NULL);
		break;
	case WM_KEYDOWN:
		if (wParam == VK_ESCAPE) 
		{
			DestroyWindow(hwnd);//销毁窗体并发送一个WM_DESTROY消息
		}
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hwnd, message, wParam, lParam);
	}
}
开发者ID:kakaxi1100,项目名称:DirectxHeaven,代码行数:21,代码来源:main.cpp

示例3: drawGraph

	void drawGraph(HWND hwnd, HDC hdc) {
	
		HPEN oldPen = NULL;
		
		POINT pt;
		
		for(int i = 0; i < mChannels.size(); i++) {

			Channel* c = &mChannels[i];

			HPEN pen = CreatePen(PS_SOLID, 2, c->getColor());
			if(i == 0) {
				oldPen = (HPEN)SelectObject(hdc, pen);
			} else {
				SelectObject(hdc, pen);
			}

			for(int j = 1; j < c->getNumKeys(); j++) {
				Key* k1 = c->getKey(j-1);
				Key* k2 = c->getKey(j);
				int x1 = toScreenX(k1->x);
				int y1 = toScreenY(k1->y);
				int x2 = toScreenX(k2->x);
				int y2 = toScreenY(k2->y);
				MoveToEx(hdc, x1, y1, &pt);
				LineTo(hdc, x2, y2);
				Rectangle(hdc, x1-3, y1-3, x1+3, y1+3);
				Rectangle(hdc, x2-3, y2-3, x2+3, y2+3);
			}

			DeleteObject(pen);
	
		}

		SelectObject(hdc, oldPen);

		RECT r;
		GetClientRect(hwnd, &r);
		ValidateRect(hwnd, &r);

	}
开发者ID:DeejStar,项目名称:Shadowgrounds-Redux,代码行数:41,代码来源:graph.cpp

示例4: WndProc

static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int res = 0;

	switch (message)
	{
		case WM_PAINT:
		{
			if (s_buffer)
			{
				StretchDIBits(s_hdc, 0, 0, s_width, s_height, 0, 0, s_width, s_height, s_buffer, 
							  &s_bitmapInfo, DIB_RGB_COLORS, SRCCOPY);

				ValidateRect(hWnd, NULL);
			}

			break;
		}

		case WM_KEYDOWN:
		{
			if ((wParam&0xFF) == 27) 
				s_close = 1;

			break;
		}

		case WM_CLOSE:
		{
			s_close = 1;
			break;
		}

		default:
		{
			res = DefWindowProc(hWnd, message, wParam, lParam);
		}
	}

	return res;
}
开发者ID:NextGenIntelligence,项目名称:ProDBG,代码行数:41,代码来源:WinMiniFB.c

示例5: repaint

	virtual void repaint()
	{
		if ( retry_count && !restore_objects() ) return;

		lpdev->Clear( 0L, NULL, D3DCLEAR_TARGET, 0x000000ff, 1.0f, 0L );

		HRESULT rv = lpdev->BeginScene();

		if( SUCCEEDED( rv ) )
		{
			set_vertex( 0, 0, input_width, input_height, surface_width, surface_height, 0, 0, rcWindow.right, rcWindow.bottom );
			lpdev->SetTexture( 0, lptex );
			lpdev->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
			lpdev->EndScene();

			if ( lpdev->Present( NULL, NULL, NULL, NULL ) == D3DERR_DEVICELOST ) retry_count = 60;
		}
		else retry_count = 60;

		ValidateRect( hWnd, & rcWindow );
	}
开发者ID:kode54,项目名称:QuickNES_Windows,代码行数:21,代码来源:display_d3d9.cpp

示例6: WinMainProc

LRESULT CALLBACK WinMainProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch (msg)
	{
	case WM_PAINT:	//客户区重绘
		Direct3DRender();//渲染图形
		ValidateRect(hWnd,NULL);//更新客户区显示
		break;
	case WM_DESTROY://窗口销毁消息
		Direct3DCleanup();//清理Direct3D
		PostQuitMessage(0);//退出
		break;
	case WM_KEYDOWN:
		if (wParam==VK_ESCAPE)//ESC键
		{
			DestroyWindow(hWnd);//销毁窗口,并发送一条WM_DESTROY消息
		}
		break;
	}
	return DefWindowProc(hWnd,msg,wParam,lParam);
}
开发者ID:haozzzzzzzz,项目名称:Direct3D_Transform,代码行数:21,代码来源:transform.cpp

示例7: WndProc

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
	switch (message)
	{
	case WM_CREATE:
		PlaySound(L"FirstBlood.wav", nullptr, SND_FILENAME | SND_ASYNC);
		break;

	case WM_PAINT:
		ValidateRect(hwnd, NULL);
		break;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;
		
	default:
		return DefWindowProc(hwnd, message, wparam, lparam);
	}
	return 0;
}
开发者ID:wakqaz4,项目名称:MyGame,代码行数:21,代码来源:main.cpp

示例8: WndProc

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{

   switch(Message){
   case WM_CREATE:
     break;
   case WM_SIZE:  
     /* This is called with 0,0 when iconized. That is bad. So don't resize
	now.*/
     wWidth = LOWORD(lParam);  // width of client area 
     wHeight = HIWORD(lParam); // height of client area 
/*       printf("Resized: %d %d\n",wWidth,wHeight); */
     /*     AccisRenewBitmap(hwnd);*/
     break;
   case WM_PAINT:
/*       printf("Paint BitBlt\n"); */
     /*Trying for private DC*/
/*       hdcWindow = BeginPaint(hwnd, &ps); */
     BitBlt(hdcWindow, 0, 0, wWidth, wHeight, hdcMemory, 0, 0, SRCCOPY);
/*         EndPaint(hwnd, &ps); */
     GetClientRect(hwnd,&wRect);
     ValidateRect(hwnd,&wRect);/* Needed without endpaint. Not perfect.
				Resize leads to continuous BitBlt.
			       Needs new/current window size.*/
     break;
   case WM_CLOSE:
       /* It is not safe to do the following from the right-hand X.
	  Makes the program hang. The Default is also bad so act the same.*/
/*       DestroyWindow(hwnd); */
/*       break; */
   case WM_DESTROY:
   case WM_LBUTTONDOWN: /* Click in window to exit from this message loop. */
     DeleteDC(hdcMemory);
     PostQuitMessage(0);
     break;
   default:
     return DefWindowProc(hwnd, Message, wParam, lParam);
   }
   return 0;
}
开发者ID:Centre-of-Plasma-Physics-IPR,项目名称:sceptic,代码行数:40,代码来源:vecwin.c

示例9: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_CREATE:
	{
		if (FAILED(InitD3D(hWnd)))
		{
			MessageBox(hWnd, TEXT("Initialize DirectX failed"), TEXT("警告"), MB_OK | MB_ICONERROR);
			PostQuitMessage(0);
		}
		break;
	}
	case WM_PAINT:
		Render(hWnd);
		ValidateRect(hWnd, NULL);
		break;
	case WM_KEYDOWN:
		if (wParam == VK_ESCAPE)
		{
			DestroyWindow(hWnd);
		}
		else
		{
			ChangeObject();
		}
		break;
	case WM_SIZE:
		OnSize((short)LOWORD(lParam), (short)HIWORD(lParam));
		break;
	case WM_DESTROY:
		Cleanup();
		PostQuitMessage(0);
		break;
	default:
		return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
	}

	return 0;
}
开发者ID:liyongfa,项目名称:DirectX,代码行数:40,代码来源:demo1.cpp

示例10: dbwWindowProc

/*-----------------------------------------------------------------------------
    Name        : dbwWindowProc
    Description : Window Procedure for debug window
    Inputs      : see Windows docs
    Outputs     : "   "       "
    Return      : "   "       "
----------------------------------------------------------------------------*/
long FAR PASCAL dbwWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    RECT rect;
    switch (message)
    {
        case WM_SETFOCUS:
            SetFocus(ghMainWindow);
            break;
        case WM_MOVE:
            GetWindowRect(hWnd, &rect);
            dbwWindowX = rect.left;
            dbwWindowY = rect.top;
            return 0;
        case WM_PAINT:
            dbwAllPanesRepaint((HDC)wParam);
            ValidateRect(hDebugWindow, NULL);
            return 0;
        case WM_DESTROY:
            return 0;
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
}
开发者ID:videogamepreservation,项目名称:homeworld,代码行数:29,代码来源:debugwnd.c

示例11: GetDC

/***************************************************
OnPaint
	The framework calls this member function when Windows
	or an application makes a request to repaint a portion
	of an application’s window.
	The CUGHint uses this event to draw the tool tip
	window.
Params:
	<none>
Returns:
	<none>
*****************************************************/
void CUGHint::OnPaint() 
{
	if ( m_ctrl->m_GI->m_paintMode == FALSE )
		return;

	CDC* dc = GetDC();

	if(m_hFont != NULL)
		dc->SelectObject(m_hFont);
	
	CRect rect;
	GetClientRect(rect);

	dc->SetTextColor(m_textColor);
	dc->SetBkColor(m_backColor);

	dc->SetBkMode(OPAQUE);
	dc->DrawText(m_text,&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);

	ReleaseDC(dc);
	ValidateRect(NULL);
}
开发者ID:Wanghuaichen,项目名称:SignalProcess,代码行数:34,代码来源:UGHint.cpp

示例12: PopupWndProc

LONG WINAPI PopupWndProc(HWND hWnd,UINT messg,UINT wParam,LONG lParam)
{
	int idPopup;
	HDC hdc;
	PAINTSTRUCT ps;
	static int xClientView,yClientView;
	static HWND hInst;
	static FARPROC fpfnAboutDiaProc;

	idPopup = GetWindowLong(hWnd, GWL_ID);
	switch (messg)
	{

          case WM_CREATE:
	    hdc =GetDC(hWnd);
	    GetTextMetrics(hdc, &tm);
	    ReleaseDC(hWnd,hdc);
	    wins[idPopup]->dwCharX = tm.tmAveCharWidth;
	    wins[idPopup]->dwCharY = tm.tmHeight;
	    return 0;

	  case WM_PAINT:
	    hdc=BeginPaint(hWnd,&ps);

	    ValidateRect(hWnd,0);
	    EndPaint(hWnd,&ps);
	    break;

	  case WM_DESTROY:
	    PostQuitMessage(0);
	    break;

	  case WM_VSCROLL:
	  case WM_HSCROLL:
	  default:
	    return(DefWindowProc(hWnd,messg,wParam,lParam));
	}
	return(0L);
}
开发者ID:BarclayII,项目名称:slashem-up,代码行数:39,代码来源:win32msg.c

示例13: SelectClipRgn

//-----------------------------------------------------------------------------
// Purpose: Finish up
//-----------------------------------------------------------------------------
CDrawHelper::~CDrawHelper( void )
{
	SelectClipRgn( m_dcMemory, NULL );

	while ( m_ClipRects.Size() > 0 )
	{
		StopClipping();
	}

	BitBlt( m_dcReal, m_x, m_y, m_w, m_h, m_dcMemory, 0, 0, SRCCOPY );

	SetBkColor( m_dcMemory, m_clrOld );

	SelectObject( m_dcMemory, m_bmOld );
	DeleteObject( m_bmMemory );

	DeleteObject( m_dcMemory );

	ReleaseDC( m_hWnd, m_dcReal );

	ValidateRect( m_hWnd, &m_rcClient );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:25,代码来源:drawhelper.cpp

示例14: switch

/**
 * Windows message process procedure
 */
LRESULT CALLBACK Application::winProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch( msg )
    {
        case WM_CLOSE:
            PostQuitMessage( 0 );
            return 0;
        
        case WM_ACTIVATE:
            isActive = HIWORD( wParam ) ? false : true;
            return 0;
            
        case WM_SYSCOMMAND:
            /* TODO (#1#): add here alt+tab or alt+enter */ 
            if (wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER)
                return 0;
            else
                break;

        case WM_PAINT:
            ValidateRect( hWnd, NULL );
            return 0;
            
        case WM_SIZE:
            Renderer::instance().resize( (int)LOWORD(lParam), (int)HIWORD(lParam) );
            return 0;
            
        case WM_KEYDOWN:
            keys[wParam] = true;
            return 0;
        
        case WM_KEYUP:
            keys[wParam] = false;
            return 0;
            
    }

    return DefWindowProc( hWnd, msg, wParam, lParam );
}
开发者ID:PixxxeL,项目名称:ogl-dx-micro-fw,代码行数:42,代码来源:Application.cpp

示例15: switch

LRESULT Win32DDFullScreen::wndProc( HWND hwnd,UINT msg,WPARAM wp,LPARAM lp,WNDPROC proc ){
	switch( msg ){
	case WM_PAINT:
		if( _excl!=this ){

		}else if( IsIconic(_hwnd.hwnd()) ){

		}else if( !primarySurface() ){

			//restore primary surface
			if( !_graphics->restore() ){
				//Argh! Don't work if an 'owned' window is active!!!!!
				break;
			}

			//create clipper
			if( _flags & BBScreen::SCREEN_GUICOMPATIBLE ){
				if( _clipper ){ _clipper->Release();_clipper=0; }
				if( win32DD.directDraw()->CreateClipper(0,&_clipper,0)<0 ){
					bbError( "Failed to create DD clipper" );
				}
				_clipper->SetHWnd( 0,_hwnd.hwnd() );
			}

			//fix gamma
//			updateGamma( false );

		}else if( _flags & BBScreen::SCREEN_GUICOMPATIBLE ){

			flip(false);
		}
		ValidateRect(hwnd,0);
		return 0;
	case WM_ERASEBKGND:
		return 1;
	}
	return Win32DDScreen::wndProc( hwnd,msg,wp,lp,proc );
}
开发者ID:JamesLinus,项目名称:blitzplus,代码行数:38,代码来源:win32ddfullscreen.cpp


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