Fix wxStaticBox appearance in high DPI in wxMSW
wxStaticBox using custom foreground color was drawing text in wrong place when using DPI scaling due to scaling the various offsets in our code, even though Windows itself doesn't do it. Fix this by following what Windows does and not scaling anything. Closes https://github.com/wxWidgets/wxWidgets/pull/1738
This commit is contained in:
committed by
Vadim Zeitlin
parent
eb7b84f781
commit
e4dcc4850c
@@ -550,15 +550,16 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT&)
|
||||
|
||||
// first we need to correctly paint the background of the label
|
||||
// as Windows ignores the brush offset when doing it
|
||||
const int x = FromDIP(LABEL_HORZ_OFFSET);
|
||||
// NOTE: Border intentionally does not use DIPs in order to match native look
|
||||
const int x = LABEL_HORZ_OFFSET;
|
||||
RECT dimensions = { x, 0, 0, height };
|
||||
dimensions.left = x;
|
||||
dimensions.right = x + width;
|
||||
|
||||
// need to adjust the rectangle to cover all the label background
|
||||
dimensions.left -= FromDIP(LABEL_HORZ_BORDER);
|
||||
dimensions.right += FromDIP(LABEL_HORZ_BORDER);
|
||||
dimensions.bottom += FromDIP(LABEL_VERT_BORDER);
|
||||
dimensions.left -= LABEL_HORZ_BORDER;
|
||||
dimensions.right += LABEL_HORZ_BORDER;
|
||||
dimensions.bottom += LABEL_VERT_BORDER;
|
||||
|
||||
if ( UseBgCol() )
|
||||
{
|
||||
|
Reference in New Issue
Block a user