Fix drawing right and bottom wxMSW wxStaticBox edges in high DPI

Passing window size divided by "scale" to CreateWithDIPSize() was wrong
as the resulting bitmap could be too small to cover the entire window
due to rounding errors, e.g. at 200% DPI the right and bottom row/column
was never drawn on if the window size in the corresponding direction was
odd.

This notably fixes their (dis)appearance in dark mode, where we always
draw them ourselves (otherwise we mostly only do it when using
non-default colour).
This commit is contained in:
Vadim Zeitlin 2024-01-06 17:36:29 +01:00
parent e97d27165a
commit 97468661c7

View file

@ -718,8 +718,8 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event))
wxMemoryDC memdc(&dc);
const double scale = dc.GetContentScaleFactor();
wxBitmap bitmap;
bitmap.CreateWithDIPSize(rc.right / scale, rc.bottom / scale, scale);
wxBitmap bitmap(rc.right, rc.bottom);
bitmap.SetScaleFactor(scale);
memdc.SelectObject(bitmap);
PaintBackground(memdc, rc);