您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetUpdateRect函数代码示例

51自学网 2021-06-01 21:17:11
  C++
这篇教程C++ GetUpdateRect函数代码示例写得很实用,希望能帮到您。

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

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

示例1: test_redraw

/* * Tests if a progress bar repaints itself immediately when it receives * some specific messages. */static void test_redraw(void){    RECT client_rect;    LRESULT ret;    SendMessageA(hProgressWnd, PBM_SETRANGE, 0, MAKELPARAM(0, 100));    SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);    SendMessageA(hProgressWnd, PBM_SETSTEP, 20, 0);    update_window(hProgressWnd);    /* PBM_SETPOS */    ok(SendMessageA(hProgressWnd, PBM_SETPOS, 50, 0) == 10, "PBM_SETPOS must return the previous position/n");    ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately/n");        /* PBM_DELTAPOS */    ok(SendMessageA(hProgressWnd, PBM_DELTAPOS, 15, 0) == 50, "PBM_DELTAPOS must return the previous position/n");    ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_DELTAPOS: The progress bar should be redrawn immediately/n");        /* PBM_SETPOS */    ok(SendMessageA(hProgressWnd, PBM_SETPOS, 80, 0) == 65, "PBM_SETPOS must return the previous position/n");    ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately/n");        /* PBM_STEPIT */    ok(SendMessageA(hProgressWnd, PBM_STEPIT, 0, 0) == 80, "PBM_STEPIT must return the previous position/n");    ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_STEPIT: The progress bar should be redrawn immediately/n");    ret = SendMessageA(hProgressWnd, PBM_GETPOS, 0, 0);    if (ret == 0)        win_skip("PBM_GETPOS needs comctl32 > 4.70/n");    else        ok(ret == 100, "PBM_GETPOS returned a wrong position : %d/n", (UINT)ret);        /* PBM_SETRANGE and PBM_SETRANGE32:    Usually the progress bar doesn't repaint itself immediately. If the    position is not in the new range, it does.    Don't test this, it may change in future Windows versions. */    SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0);    update_window(hProgressWnd);    /* increase to 10 - no background erase required */    erased = FALSE;    SetRectEmpty(&last_paint_rect);    SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);    GetClientRect(hProgressWnd, &client_rect);    ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s/n",       wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect));    update_window(hProgressWnd);    ok(!erased, "Progress bar shouldn't have erased the background/n");    /* decrease to 0 - background erase will be required */    erased = FALSE;    SetRectEmpty(&last_paint_rect);    SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0);    GetClientRect(hProgressWnd, &client_rect);    ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s/n",       wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect));    update_window(hProgressWnd);    ok(erased, "Progress bar should have erased the background/n");}
开发者ID:AndreRH,项目名称:wine,代码行数:63,


示例2: GetUpdateRect

void CTitleStatic::OnPaint(){   PAINTSTRUCT paintStruct;   DWORD dwRes = GetUpdateRect(NULL);   if (dwRes == 0)      return;   CDC *pDC = BeginPaint(&paintStruct);   CRect rect;   GetClientRect(&rect);   /*   CBrush brush(::GetSysColor(COLOR_ACTIVECAPTION));   pDC->FillRect(&rect, &brush);   CString csText;   GetWindowText(csText);   int nOldMode = pDC->SetBkMode(TRANSPARENT);   pDC->DrawText(csText, &rect, DT_SINGLELINE | DT_VCENTER);   */      //::DrawCaption(GetSafeHwnd(), pDC->GetSafeHdc(), &rect, DC_ACTIVE | DC_SMALLCAP | DC_TEXT | DC_GRADIENT);   //::DrawCaption(GetSafeHwnd(), pDC->GetSafeHdc(), &rect, DC_ACTIVE | DC_SMALLCAP | DC_TEXT);   ::DrawCaption(GetSafeHwnd(), pDC->GetSafeHdc(), &rect, DC_SMALLCAP | DC_TEXT);   EndPaint(&paintStruct);}
开发者ID:identity0815,项目名称:os45,代码行数:26,


示例3: GetClientRect

void CNSToolbar2::OnPaint(void){    CRect rcClient, updateRect, buttonRect, intersectRect;    GetClientRect(&rcClient);    GetUpdateRect(&updateRect);    CPaintDC dcPaint(this);    // Use our background color    ::FillRect(dcPaint.m_hDC, &rcClient, sysInfo.m_hbrBtnFace);    for (int i = 0; i < m_nNumButtons; i++)    {        m_pButtonArray[i]->GetClientRect(&buttonRect);        m_pButtonArray[i]->MapWindowPoints(this, &buttonRect);        if(intersectRect.IntersectRect(updateRect, buttonRect))        {            MapWindowPoints(m_pButtonArray[i], &intersectRect);            m_pButtonArray[i]->RedrawWindow(&intersectRect);        }    }}
开发者ID:vicamo,项目名称:b2g_mozilla-central,代码行数:27,


示例4: on_WM_PAINT

static LPARAMon_WM_PAINT(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp){	HDC dc;	PAINTSTRUCT ps;	// WM_PAINT message	// http://msdn.microsoft.com/en-us/library/windows/desktop/dd145213(v=vs.85).aspx	// > A window may receive internal paint messages as a result	// > of calling RedrawWindow with the RDW_INTERNALPAINT flag	// > set. In this case, the window may not have an update	// > region. An application should call the GetUpdateRect	// > function to determine whether the window has an	// > update region. If GetUpdateRect returns zero, the	// > application should not call the BeginPaint and EndPaint	// > functions.	if (GetUpdateRect(hwnd, NULL, FALSE) == 0) {		return 0;	}	dc = BeginPaint(hwnd, &ps);	TextOut(dc, 0, 0, _T("hello"), 5);	EndPaint(hwnd, &ps);	return 0;}
开发者ID:vbarbarosh,项目名称:w339_winapi_env,代码行数:26,


示例5: OnPaint

void gfxPreviewWind::OnPaint() {	if (!mlEdit.isMaterialListValid())		return;		if (m_matType == TS::Material::MatPalette || m_matType == TS::Material::MatTexture ||		m_matType == TS::Material::MatNull) {		RECT rect;		if (GetUpdateRect(&rect)) {			PAINTSTRUCT ps;			BeginPaint(&ps);			Refresh();			EndPaint(&ps);		} else {			Refresh();		}	} else {		// The material is an RGB, so we'll call on windows to display it, dithering in 256		// color mode, or displaying real color in true-color modes...		//		CPaintDC dc(this); // device context for painting				UInt8 red   = m_pMaterial->fParams.fRGB.fRed;		UInt8 green = m_pMaterial->fParams.fRGB.fGreen;		UInt8 blue  = m_pMaterial->fParams.fRGB.fBlue;				COLORREF m_color = RGB(red, green, blue);		CBrush brRGB( m_color );		dc.FillRect( &dc.m_ps.rcPaint, &brRGB );	}}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:32,


示例6: getDirtyRects

static void getDirtyRects(HWND window, Vector<CGRect>& outRects){    ASSERT_ARG(outRects, outRects.isEmpty());    RECT clientRect;    if (!GetClientRect(window, &clientRect))        return;    auto region = adoptGDIObject(::CreateRectRgn(0, 0, 0, 0));    int regionType = GetUpdateRgn(window, region.get(), false);    if (regionType != COMPLEXREGION) {        RECT dirtyRect;        if (GetUpdateRect(window, &dirtyRect, false))            outRects.append(winRectToCGRect(dirtyRect, clientRect));        return;    }    DWORD dataSize = ::GetRegionData(region.get(), 0, 0);    auto regionDataBuffer = std::make_unique<unsigned char[]>(dataSize);    RGNDATA* regionData = reinterpret_cast<RGNDATA*>(regionDataBuffer.get());    if (!::GetRegionData(region.get(), dataSize, regionData))        return;    outRects.resize(regionData->rdh.nCount);    RECT* rect = reinterpret_cast<RECT*>(regionData->Buffer);    for (size_t i = 0; i < outRects.size(); ++i, ++rect)        outRects[i] = winRectToCGRect(*rect, clientRect);}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:29,


示例7: OfficePanePaint

/******************************************************************************* OfficePanePaint  **------------------**   Description:*       Do the paint on the office pane.*******************************************************************************/void OfficePanePaint( HWND hWnd ){    if ( GetUpdateRect( hWnd, NULL, TRUE ) )    {        PAINTSTRUCT ps;        HDC hDC;        TCHAR tBuf[MAX_LOADSTRING];        BeginPaint( hWnd, &ps );        hDC = ps.hdc;        HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont );        COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) );        SetBkMode(hDC, TRANSPARENT);                RECT rc;        RECT clientRC;        GetClientRect( hWnd, &clientRC );                LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING );        rc.left = 0;        rc.right = 450;        int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK );        int iWidth = rc.right - rc.left;        rc.left = (clientRC.right - iWidth) / 2;        rc.right = rc.left + iWidth;        rc.top = 25;        rc.bottom = rc.top + iHeight + 1;        DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK );                SetTextColor( hDC, sOldColor );        SelectObject( hDC, hOldFont );        EndPaint( hWnd, &ps );    }        }
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:40,


示例8: SysMsgHook

LRESULT CALLBACK SysMsgHook(int nCode, WPARAM wParam, LPARAM lParam){	MSG *cw = (MSG*)lParam;	switch (cw->message) {		case WM_ERASEBKGND:		case WM_PAINT:			if (cw->hwnd == desktopWnd) {				RECT rt;				if (!GetUpdateRect(cw->hwnd, &rt, false)) {					::GetClientRect(cw->hwnd, &rt);				}				WaitForSingleObject(hSem, INFINITE);				UnionRect(&dskWndPaintedRect, &dskWndPaintedRect, &rt);				ReleaseSemaphore(hSem, 1, NULL);				dskWndPainted = TRUE;			}			break;		default:			break;	}	return CallNextHookEx(hWndMsgHook, nCode, wParam, lParam);}
开发者ID:AnotherFoxGuy,项目名称:winpenguins,代码行数:27,


示例9: GetUpdateRect

BOOL CColorStatic::OnEraseBkgnd(CDC* pDC){	CRect rcClient;	GetUpdateRect(&rcClient);			  	pDC->FillSolidRect(rcClient, RGB(255,255,255));		return FALSE;	}
开发者ID:idaohang,项目名称:GNSS_Viewer_V2,代码行数:7,


示例10: Paint

void PlayerPanel::Paint(){  if (Handle != NULL && GetUpdateRect(Handle, NULL, 0) != 0)  {    PAINTSTRUCT PS;    HDC DC = BeginPaint(Handle, &PS);    if (DC != NULL)    {      /* Create a buffer DC to draw on */      HDC Buffer = CreateCompatibleDC(DC);      HBITMAP Bitmap = CreateCompatibleBitmap(DC,Width,Height);      SelectObject(Buffer, Bitmap);      /* Paint the background */      HBRUSH OldBrush = (HBRUSH)SelectObject(Buffer,CreateSolidBrush(GetSysColor(COLOR_BTNFACE)));      HPEN OldPen = (HPEN)SelectObject(Buffer,CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNFACE)));      Rectangle(Buffer,0,0,Width,Height);      DeleteObject(SelectObject(Buffer,OldPen));      DeleteObject(SelectObject(Buffer,OldBrush));      /* Draw the chess piece */      DrawChessPiece(Buffer,0,2);      /* Draw the player's information */      DrawPlayerInformation(Buffer,Height-2,1,Width-Height,Height-2);      /* Draw the buffer into the destination DC */      BitBlt(DC,0,0,Width,Height,Buffer,0,0,SRCCOPY);      /* Cleanup */      DeleteDC(Buffer);      DeleteObject(Bitmap);    }    EndPaint(Handle, &PS);  }}
开发者ID:Malbeth81,项目名称:alphachess,代码行数:31,


示例11: DoOnPaint

void CDeviceView::DoOnPaint(HDC hDC){	// Paint only if we have an update region.	if (GetUpdateRect(m_hWnd, NULL, FALSE) || m_bForcePaint)		OnPaint(hDC);	m_bForcePaint = FALSE;}
开发者ID:grakidov,项目名称:Render3D,代码行数:7,


示例12: OnPaint

//-----------------------------------------------------------------------------// Purpose: Renders the title window. A special font is used if the mouse is//			over the title window or if the window's menu is open.//-----------------------------------------------------------------------------void CTitleWnd::OnPaint(void){	if (m_szTitle[0] != '/0')	{		if (GetUpdateRect(NULL, TRUE))		{			CPaintDC dc(this);			CFont *pFontOld;			if ((m_bMouseOver) || (m_bMenuOpen))			{				pFontOld = dc.SelectObject(&m_FontActive);				dc.SetTextColor(RGB(255, 255, 255));			}			else			{				pFontOld = dc.SelectObject(&m_FontNormal);				dc.SetTextColor(RGB(200, 200, 200));			}			dc.SetBkMode(TRANSPARENT);			dc.TextOut(0, 0, m_szTitle, strlen(m_szTitle));			dc.SelectObject(pFontOld);		}	}}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:30,


示例13: getDirtyRects

static void getDirtyRects(HWND window, Vector<CGRect>& outRects){    ASSERT_ARG(outRects, outRects.isEmpty());    RECT clientRect;    if (!GetClientRect(window, &clientRect))        return;    HRGN region = CreateRectRgn(0, 0, 0, 0);    int regionType = GetUpdateRgn(window, region, false);    if (regionType != COMPLEXREGION) {        RECT dirtyRect;        if (GetUpdateRect(window, &dirtyRect, false))            outRects.append(winRectToCGRect(dirtyRect, clientRect));        return;    }    DWORD dataSize = GetRegionData(region, 0, 0);    OwnArrayPtr<unsigned char> regionDataBuffer(new unsigned char[dataSize]);    RGNDATA* regionData = reinterpret_cast<RGNDATA*>(regionDataBuffer.get());    if (!GetRegionData(region, dataSize, regionData))        return;    outRects.resize(regionData->rdh.nCount);    RECT* rect = reinterpret_cast<RECT*>(regionData->Buffer);    for (size_t i = 0; i < outRects.size(); ++i, ++rect)        outRects[i] = winRectToCGRect(*rect, clientRect);    DeleteObject(region);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:31,


示例14: CounterPanePaint

/******************************************************************************* CounterPanePaint **------------------**   Description:*       Do the paint on the counter pane.*******************************************************************************/void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ){    if ( GetUpdateRect( hWnd, NULL, TRUE ) )    {        PAINTSTRUCT ps;        HDC hDC;        BeginPaint( hWnd, &ps );        hDC = ps.hdc;        HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont );        COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) );        SetBkMode(hDC, TRANSPARENT);                RECT rc;        RECT clientRC;        GetClientRect( hWnd, &clientRC );                rc.left = 0;        rc.right = 450;        int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK );        int iWidth = rc.right - rc.left;        rc.left = (clientRC.right - iWidth) / 2;        rc.right = rc.left + iWidth;        rc.top = 100;        rc.bottom = rc.top + iHeight + 1;        DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK );                SetTextColor( hDC, sOldColor );        SelectObject( hDC, hOldFont );        EndPaint( hWnd, &ps );    }}
开发者ID:mkane848,项目名称:HLPlague,代码行数:39,


示例15: BoxPreviewWndProc

INT_PTR CALLBACK BoxPreviewWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){	switch (msg) {	case WM_PAINT:		if (GetUpdateRect(hwnd, 0, FALSE)) {			PAINTSTRUCT ps;			HDC mydc = BeginPaint(hwnd, &ps);			BoxPreview_OnPaint(hwnd, mydc, GetWindowLongPtr(hwnd, GWLP_USERDATA));			EndPaint(hwnd, &ps);			return TRUE;		}		break;	case WM_PRINT:	case WM_PRINTCLIENT:		BoxPreview_OnPaint(hwnd, (HDC)wParam, GetWindowLongPtr(hwnd, GWLP_USERDATA));		return TRUE;	case WM_LBUTTONDOWN:		ReleaseCapture();		SendMessage(hwnd, WM_SYSCOMMAND, 0xF012 /*SC_DRAGMOVE*/, 0);		return TRUE;	}	return DefWindowProc(hwnd, msg, wParam, lParam);}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:25,


示例16: SpectrumWindowProc

// window procedureLRESULT CALLBACK SpectrumWindowProc(HWND h, UINT m, WPARAM w, LPARAM l){	switch (m) {		case WM_LBUTTONDOWN:		case WM_RBUTTONDOWN:		case WM_MOUSEMOVE:			if (w&MK_LBUTTON) SetLoopStart(LOWORD(l)*bpp); // set loop start			if (w&MK_RBUTTON) SetLoopEnd(LOWORD(l)*bpp); // set loop end			return 0;		case WM_MBUTTONDOWN:			BASS_ChannelSetPosition(chan,LOWORD(l)*bpp,BASS_POS_BYTE); // set current pos			return 0;		case WM_TIMER:			InvalidateRect(h,0,0); // refresh window			return 0;		case WM_PAINT:			if (GetUpdateRect(h,0,0)) {				PAINTSTRUCT p;				HDC dc;				if (!(dc=BeginPaint(h,&p))) return 0;				BitBlt(dc,0,0,WIDTH,HEIGHT,wavedc,0,0,SRCCOPY); // draw peak waveform				DrawTimeLine(dc,loop[0],0xffff00,12); // loop start				DrawTimeLine(dc,loop[1],0x00ffff,24); // loop end				DrawTimeLine(dc,BASS_ChannelGetPosition(chan,BASS_POS_BYTE),0xffffff,0); // current pos				EndPaint(h,&p);			}			return 0;		case WM_CREATE:			win=h;			// initialize output			if (!BASS_Init(-1,44100,0,win,NULL)) {				Error("Can't initialize device");				return -1;			}			if (!PlayFile()) { // start a file playing				BASS_Free();				return -1;			}			SetTimer(h,0,100,0); // set update timer (10hz)			break;		case WM_DESTROY:			KillTimer(h,0);			if (scanthread) { // still scanning				killscan=TRUE;				WaitForSingleObject((HANDLE)scanthread,1000); // wait for the thread			}			BASS_Free();			if (wavedc) DeleteDC(wavedc);			if (wavebmp) DeleteObject(wavebmp);			PostQuitMessage(0);			break;	}	return DefWindowProc(h, m, w, l);}
开发者ID:Emulai,项目名称:ICT397-Project,代码行数:60,


示例17: GetUpdateRect

//-----------------------------------------------------------------------------// Purpose: // Input  : pDC - // Output : Returns TRUE on success, FALSE on failure.//-----------------------------------------------------------------------------BOOL CTextureBox::OnEraseBkgnd(CDC *pDC) {	CRect r;	GetUpdateRect(r);	pDC->SetROP2(R2_COPYPEN);	FillRect(pDC->m_hDC, r, HBRUSH(GetStockObject(BLACK_BRUSH)));	return TRUE;}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:13,


示例18: GetDlgItem

void as_Sound::updateGridColored(){    HWND hWndGrid;    HDC hDC;    RECT rc;    //    static LONG s_lPixel[5] = { CLR_INVALID, CLR_INVALID, CLR_INVALID, CLR_INVALID, CLR_INVALID };    static LONG s_lX = 0;    static LONG s_lY = 0;    COLORREF color = 0;    COLORREF darkColor = 0;    if (NULL == hWndGridView)        return;    hWndGrid = GetDlgItem(hWndGridView, IDC_GRID);    hDC = GetDC(hWndGrid);    // Don't update the grid if a WM_PAINT will be called soon    BOOL bUpdateInProgress = GetUpdateRect(hWndGridView, NULL, FALSE);    if (bUpdateInProgress)    {        return;    }    color = this->color;    darkColor = RGB(GetRValue(color) * 0.5, GetGValue(color) * 0.5, GetBValue(color) * 0.5);    s_lX = this->oldGridPosX;    s_lY = this->oldGridPosY;    // Draw a crosshair object darker than normal the trail    SetPixel(hDC, s_lX - 1, s_lY + 0, darkColor);    SetPixel(hDC, s_lX + 0, s_lY - 1, darkColor);    SetPixel(hDC, s_lX + 0, s_lY + 0, darkColor);    SetPixel(hDC, s_lX + 0, s_lY + 1, darkColor);    SetPixel(hDC, s_lX + 1, s_lY + 0, darkColor);    // Convert the world space x,y coordinates to pixel coordinates    GetClientRect(hWndGrid, &rc);    // attention: x, z are horizontal, y is vertical axis !!!    s_lX = (LONG)(((rc.right - rc.left) / 2) + 50 * (this->Position[0]));    s_lY = (LONG)(((rc.bottom - rc.top) / 2) - 50 * (this->Position[2]));    // Draw a crosshair object in light pixels    SetPixel(hDC, s_lX - 1, s_lY + 0, color);    SetPixel(hDC, s_lX + 0, s_lY - 1, color);    SetPixel(hDC, s_lX + 0, s_lY + 0, color);    SetPixel(hDC, s_lX + 0, s_lY + 1, color);    SetPixel(hDC, s_lX + 1, s_lY + 0, color);    ReleaseDC(hWndGrid, hDC);    this->oldGridPosX = s_lX;    this->oldGridPosY = s_lY;}
开发者ID:nixz,项目名称:covise,代码行数:58,


示例19: Proc

LRESULT CALLBACK Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {    Window* window = (Window*)GetWindowLong(hwnd, GWL_USERDATA);    switch (message) {    case  WM_ERASEBKGND:        return true;    case WM_PAINT:        {            RECT rect;            GetUpdateRect(hwnd, &rect, FALSE);            SkRect clip_rect = SkRect::MakeXYWH(                SkIntToScalar(rect.left),                 SkIntToScalar(rect.top),                 SkIntToScalar(rect.right - rect.left),                SkIntToScalar(rect.bottom - rect.top));            window->Draw(clip_rect);            TexturePool::GetInstance()->CanvasToScreen(clip_rect);        }        break;    case WM_SIZE:        {            if(wParam != SIZE_MINIMIZED) {                RECT rect;                GetClientRect(hwnd, &rect);                window->SetGeometry(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);                window->Dolayout();            }        }        break;    case WM_GETMINMAXINFO:        {            LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;            if(window->LimitMaxWidth() < (int)(INT32_MAX - GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYBORDER))) {                lpMMI->ptMaxTrackSize.x = window->LimitMaxWidth() + GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYBORDER);            }            if(window->LimitMaxHeight() < (int)(INT32_MAX - GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYBORDER))) {                lpMMI->ptMaxTrackSize.y = window->LimitMaxHeight() + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYBORDER);            }            RECT inner_rect, window_rect;            GetClientRect(hwnd, &inner_rect);            GetWindowRect(hwnd, &window_rect);            lpMMI->ptMinTrackSize.x = window->LimitMinWidth() +                 ((window_rect.right - window_rect.left) - (inner_rect.right - inner_rect.left));            lpMMI->ptMinTrackSize.y = window->LimitMinHeight() +                ((window_rect.bottom - window_rect.top) - (inner_rect.bottom - inner_rect.top));        }    default:        auto events = EventFactory::GetInstance()->CreateEvent(message, wParam, lParam);        for (auto event:events) {            if(event && event->Target()) {                event->Target()->DoEvent(event.get());            }        }    }    return CallWindowProc(window->oldProc_, hwnd, message, wParam, lParam);}
开发者ID:koalamrfan,项目名称:koala,代码行数:57,


示例20: EntryPanePaint

/******************************************************************************* EntryPanePaint **----------------**   Description:*       Do the paint on the entry pane.*******************************************************************************/void EntryPanePaint( HWND hWnd, LPCTSTR szName ){    if ( GetUpdateRect( hWnd, NULL, TRUE ) )    {        PAINTSTRUCT ps;        HDC hDC;        TCHAR tBuf[MAX_LOADSTRING];        TCHAR tLoadBuf[MAX_LOADSTRING];        BeginPaint( hWnd, &ps );        hDC = ps.hdc;        HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont );        COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) );        SetBkMode(hDC, TRANSPARENT);                RECT rc;        RECT clientRC;        GetClientRect( hWnd, &clientRC );                rc.left = 0;        rc.right = 100;        LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING );        int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK );        rc.left += 25;        rc.right += 25;        rc.top = ( clientRC.bottom - iHeight ) / 2;        rc.bottom = rc.top + iHeight + 1;        DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK );                rc.left = 0;        rc.right = 100;        LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING );        iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK );        rc.left = clientRC.right - 125;        rc.right = rc.left + 100;        rc.top = ( clientRC.bottom - iHeight ) / 2;        rc.bottom = rc.top + iHeight + 1;        DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK );        LoadString( g_hInst, IDS_WELCOME, tLoadBuf, MAX_LOADSTRING );        _stprintf_s( tBuf, _countof(tBuf), tLoadBuf, szName );        rc.left = 0;        rc.right = 450;        iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK );        int iWidth = rc.right - rc.left;        rc.left = (clientRC.right - iWidth) / 2;        rc.right = rc.left + iWidth;        rc.top = 25;        rc.bottom = rc.top + iHeight + 1;        DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK );                SetTextColor( hDC, sOldColor );        SelectObject( hDC, hOldFont );        EndPaint( hWnd, &ps );    }}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:63,


示例21: onChangeFocus

LRESULT HubMessageControl::onChangeFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {  if (GetUpdateRect(NULL, FALSE)) {    Invalidate();  }  else {    dcdebug("call drawFocusRect in onChangeFocus/n");    CClientDC dc(m_hWnd);    drawFocusRect(dc);  }  return 0;}
开发者ID:inetra,项目名称:peers1,代码行数:11,


示例22: progress_subclass_proc

static LRESULT CALLBACK progress_subclass_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){    if (msg == WM_PAINT)    {        GetUpdateRect(hWnd, &last_paint_rect, FALSE);    }    else if (msg == WM_ERASEBKGND)    {        erased = TRUE;    }    return CallWindowProcA(progress_wndproc, hWnd, msg, wParam, lParam);}
开发者ID:AndreRH,项目名称:wine,代码行数:12,


示例23: OnPaint

void CMatCanvas::OnPaint(){	RECT rect;	if (GetUpdateRect(&rect)) {		PAINTSTRUCT ps;	  	BeginPaint(&ps);		Refresh();		EndPaint(&ps);	}	else		Refresh();}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:12,


示例24: init

static void init(void){    HMODULE hComctl32;    BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);    WNDCLASSA wc;    RECT rect;    BOOL ret;    hComctl32 = GetModuleHandleA("comctl32.dll");    pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");    if (pInitCommonControlsEx)    {        INITCOMMONCONTROLSEX iccex;        iccex.dwSize = sizeof(iccex);        iccex.dwICC  = ICC_PROGRESS_CLASS;        pInitCommonControlsEx(&iccex);    }    else        InitCommonControls();      wc.style = CS_HREDRAW | CS_VREDRAW;    wc.cbClsExtra = 0;    wc.cbWndExtra = 0;    wc.hInstance = GetModuleHandleA(NULL);    wc.hIcon = NULL;    wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);    wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);    wc.lpszMenuName = NULL;    wc.lpszClassName = progressTestClass;    wc.lpfnWndProc = progress_test_wnd_proc;    RegisterClassA(&wc);    SetRect(&rect, 0, 0, 400, 20);    ret = AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);    ok(ret, "got %d/n", ret);        hProgressParentWnd = CreateWindowExA(0, progressTestClass, "Progress Bar Test", WS_OVERLAPPEDWINDOW,      CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, GetModuleHandleA(NULL), 0);    ok(hProgressParentWnd != NULL, "failed to create parent wnd/n");    GetClientRect(hProgressParentWnd, &rect);    hProgressWnd = CreateWindowExA(0, PROGRESS_CLASSA, "", WS_CHILD | WS_VISIBLE,      0, 0, rect.right, rect.bottom, hProgressParentWnd, NULL, GetModuleHandleA(NULL), 0);    ok(hProgressWnd != NULL, "failed to create parent wnd/n");    progress_wndproc = (WNDPROC)SetWindowLongPtrA(hProgressWnd, GWLP_WNDPROC, (LPARAM)progress_subclass_proc);        ShowWindow(hProgressParentWnd, SW_SHOWNORMAL);    ok(GetUpdateRect(hProgressParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated/n");    flush_events();    update_window(hProgressParentWnd);    }
开发者ID:AndreRH,项目名称:wine,代码行数:51,


示例25: BeginPaint

HDC WINAPI BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint){	HDC	hdc;	/* first update non-client area*/	if(mwforceNCpaint || hwnd->paintNC != mwpaintNC) {		MwPaintNCArea(hwnd);		hwnd->paintNC = mwpaintNC;	}	/* If ERASEMOVE:	 * Don't allow windows to repaint while user is moving	 * a window.  Instead, just erase backgrounds	 * and indicate delayed painting required, which	 * will occur after user completes window move.	 */	if(mwERASEMOVE && dragwp) {		hdc = NULL;		lpPaint->fErase = !DefWindowProc(hwnd, WM_ERASEBKGND, 0, 0L);		hwnd->gotPaintMsg = PAINT_DELAYPAINT;	} else {		HideCaret(hwnd);		/* FIXME: mdemo requires update excluded or draw errors occur*/		hdc = GetDCEx(hwnd, NULL, DCX_DEFAULTCLIP				|DCX_EXCLUDEUPDATE);	/* FIXME - bug*/		/* erase client background, always w/alpha blending*/		if(hwnd->nEraseBkGnd > 0 || mwforceNCpaint)			lpPaint->fErase = !SendMessage(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0L);		else			lpPaint->fErase = 0;		hwnd->nEraseBkGnd = 0;	}	lpPaint->hdc = hdc;	if( hwnd->paintBrush != NULL )		DeleteObject ( hwnd->paintBrush );	if( hwnd->paintPen != NULL )		DeleteObject ( hwnd->paintPen );	hwnd->paintBrush = NULL;	hwnd->paintPen = NULL;	GetUpdateRect(hwnd, &lpPaint->rcPaint, FALSE);	return hdc;}
开发者ID:BadrElh,项目名称:microwindows,代码行数:48,


示例26: Wm_PaintProc

static	LRESULT	Wm_PaintProc(HWND hWnd){	PAINTSTRUCT	ps;	HDC			PaintDC;	// TODO: Add any drawing code here...	if(GetUpdateRect(hWnd,NULL,TRUE))	{	    char tmp[200];	    PaintDC=BeginPaint(hWnd,&ps);	    sprintf(tmp,"DrawGr((HDC)%ld",PaintDC);	    G__calc(tmp); /* Call Cint parser */	    /* DrawGr(PaintDC); */	    EndPaint(hWnd, &ps);	}	return	0;}
开发者ID:309972460,项目名称:software,代码行数:17,


示例27: UpdateGrid

//-----------------------------------------------------------------------------// Name: UpdateGrid()// Desc: Draws a red dot in the dialog's grid bitmap at the x,y coordinate.//-----------------------------------------------------------------------------VOID UpdateGrid( HWND hDlg, FLOAT x, FLOAT y ){    static LONG s_lPixel[5] = { CLR_INVALID,CLR_INVALID,CLR_INVALID,CLR_INVALID,CLR_INVALID };    static LONG s_lX = 0;    static LONG s_lY = 0;    HWND hWndGrid = GetDlgItem( hDlg, IDC_RENDER_WINDOW );    HDC  hDC      = GetDC( hWndGrid );    RECT rc;    // Don't update the grid if a WM_PAINT will be called soon    BOOL bUpdateInProgress = GetUpdateRect(hDlg,NULL,FALSE);    if( bUpdateInProgress )        return;    if( s_lPixel[0] != CLR_INVALID )     {        // Replace pixels from that were overdrawn last time        SetPixel( hDC, s_lX-1, s_lY+0, s_lPixel[0] );        SetPixel( hDC, s_lX+0, s_lY-1, s_lPixel[1] );        SetPixel( hDC, s_lX+0, s_lY+0, s_lPixel[2] );        SetPixel( hDC, s_lX+0, s_lY+1, s_lPixel[3] );        SetPixel( hDC, s_lX+1, s_lY+0, s_lPixel[4] );       }    // Convert the world space x,y coordinates to pixel coordinates    GetClientRect( hWndGrid, &rc );    s_lX = (LONG)( ( x/ORBIT_MAX_RADIUS + 1 ) * ( rc.left + rc.right ) / 2 );    s_lY = (LONG)( (-y/ORBIT_MAX_RADIUS + 1 ) * ( rc.top + rc.bottom ) / 2 );    // Save the pixels before drawing the cross hair    s_lPixel[0] = GetPixel( hDC, s_lX-1, s_lY+0 );    s_lPixel[1] = GetPixel( hDC, s_lX+0, s_lY-1 );    s_lPixel[2] = GetPixel( hDC, s_lX+0, s_lY+0 );    s_lPixel[3] = GetPixel( hDC, s_lX+0, s_lY+1 );    s_lPixel[4] = GetPixel( hDC, s_lX+1, s_lY+0 );    // Draw a crosshair object in red pixels    SetPixel( hDC, s_lX-1, s_lY+0, 0x000000ff );    SetPixel( hDC, s_lX+0, s_lY-1, 0x000000ff );    SetPixel( hDC, s_lX+0, s_lY+0, 0x000000ff );    SetPixel( hDC, s_lX+0, s_lY+1, 0x000000ff );    SetPixel( hDC, s_lX+1, s_lY+0, 0x000000ff );    ReleaseDC( hWndGrid, hDC );}
开发者ID:grakidov,项目名称:Render3D,代码行数:50,



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


C++ GetUser函数代码示例
C++ GetUniverse函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。