diff options
-rw-r--r-- | win32/PlatWin.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index f33b1fcd3..87840ff3b 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -3203,15 +3203,17 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) { ID2D1DCRenderTarget *pDCRT = nullptr; HRESULT hr = pD2DFactory->CreateDCRenderTarget(&props, &pDCRT); if (SUCCEEDED(hr) && pDCRT) { - RECT rcWindow; - GetClientRect(pDrawItem->hwndItem, &rcWindow); - hr = pDCRT->BindDC(pDrawItem->hDC, &rcWindow); + const long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x); + + RECT rcItem = pDrawItem->rcItem; + rcItem.left = left; + rcItem.right = rcItem.left + images.GetWidth(); + + hr = pDCRT->BindDC(pDrawItem->hDC, &rcItem); if (SUCCEEDED(hr)) { surfaceItem->Init(pDCRT, pDrawItem->hwndItem); pDCRT->BeginDraw(); - const long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x); - const PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top, - left + images.GetWidth(), pDrawItem->rcItem.bottom); + const PRectangle rcImage = PRectangle::FromInts(0, 0, images.GetWidth(), rcItem.bottom - rcItem.top); surfaceItem->DrawRGBAImage(rcImage, pimage->GetWidth(), pimage->GetHeight(), pimage->Pixels()); pDCRT->EndDraw(); |