• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetUpdateRect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了GetUpdateRect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:progress.c


示例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,代码来源:TitleStatic.cpp


示例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,代码来源:toolbar2.cpp


示例4: on_WM_PAINT

static LPARAM
on_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,代码来源:desktop-app.c


示例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,代码来源:gfxPreviewWind.cpp


示例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,代码来源:CACFLayerTreeHost.cpp


示例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,代码来源:display.cpp


示例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,代码来源:Winmon.cpp


示例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,代码来源:ColorStatic.cpp


示例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,代码来源:playerpanel.cpp


示例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,代码来源:cdeviceview.cpp


示例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,代码来源:titlewnd.cpp


示例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,代码来源:WKCACFLayerRenderer.cpp


示例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,代码来源:display.cpp


示例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,代码来源:opt_skins.cpp


示例16: SpectrumWindowProc

// window procedure
LRESULT 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,代码来源:custloop.c


示例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,代码来源:texturebox.cpp


示例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,代码来源:as_Sound.cpp


示例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,代码来源:ywindow.cpp


示例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,代码来源:display.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetUser函数代码示例发布时间:2022-05-30
下一篇:
C++ GetUniverse函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap