MCPcopy Create free account
hub / github.com/TortoiseGit/TortoiseGit / PaintControl

Function PaintControl

src/Utils/Theme.cpp:1402–1439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1400}
1401
1402void PaintControl(HWND hWnd, HDC hdc, RECT* prc, bool bDrawBorder)
1403{
1404 HDC hdcPaint = nullptr;
1405
1406 if (bDrawBorder)
1407 InflateRect(prc, 1, 1);
1408 HPAINTBUFFER hBufferedPaint = BeginBufferedPaint(hdc, prc, BPBF_TOPDOWNDIB, nullptr, &hdcPaint);
1409 if (hdcPaint && hBufferedPaint)
1410 {
1411 RECT rc;
1412 GetWindowRect(hWnd, &rc);
1413
1414 PatBlt(hdcPaint, 0, 0, RECTWIDTH(rc), RECTHEIGHT(rc), BLACKNESS);
1415 BufferedPaintSetAlpha(hBufferedPaint, &rc, 0x00);
1416
1417 ///
1418 /// first blit white so list ctrls don't look ugly:
1419 ///
1420 PatBlt(hdcPaint, 0, 0, RECTWIDTH(rc), RECTHEIGHT(rc), WHITENESS);
1421
1422 if (bDrawBorder)
1423 InflateRect(prc, -1, -1);
1424 // Tell the control to paint itself in our memory buffer
1425 SendMessage(hWnd, WM_PRINTCLIENT, reinterpret_cast<WPARAM>(hdcPaint), PRF_CLIENT | PRF_ERASEBKGND | PRF_NONCLIENT | PRF_CHECKVISIBLE);
1426
1427 if (bDrawBorder)
1428 {
1429 InflateRect(prc, 1, 1);
1430 FrameRect(hdcPaint, prc, static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH)));
1431 }
1432
1433 // don't make a possible border opaque, only the inner part of the control
1434 InflateRect(prc, -2, -2);
1435 // Make every pixel opaque
1436 BufferedPaintSetAlpha(hBufferedPaint, prc, 255);
1437 EndBufferedPaint(hBufferedPaint, TRUE);
1438 }
1439}
1440
1441BOOL DetermineGlowSize(int* piSize, LPCWSTR pszClassIdList /*= nullptr*/)
1442{

Callers 1

ButtonSubclassProcMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected