diff --git a/src/generic/caret.cpp b/src/generic/caret.cpp index 093ce01094..f9add3875d 100644 --- a/src/generic/caret.cpp +++ b/src/generic/caret.cpp @@ -29,6 +29,7 @@ #endif //WX_PRECOMP #include "wx/caret.h" +#include "wx/graphics.h" // ---------------------------------------------------------------------------- // global variables for this module @@ -290,8 +291,21 @@ void wxCaret::DoDraw(wxDC *dc, wxWindow* win) } else { + pen.SetJoin(wxJOIN_MITER); dc->SetPen(pen); dc->SetBrush(*wxTRANSPARENT_BRUSH); +#if wxUSE_GRAPHICS_CONTEXT + wxGraphicsContext* gc = dc->GetGraphicsContext(); + if (gc) + { + // Draw outline rect so that its outside edges correspond with + // those of the solid rect. This is necessary to avoid drawing + // outside the solid rect bounds when window content is scaled. + gc->EnableOffset(false); + gc->DrawRectangle(m_x + 0.5, m_y + 0.5, m_width - 1, m_height - 1); + return; + } +#endif } // VZ: unfortunately, the rectangle comes out a pixel smaller when this is