+ wxBrush brush(dc.GetBrush());
+ wxPen pen(dc.GetPen());
+ if (brush.Ok() && brush.GetStyle() != wxTRANSPARENT)
+ {
+ HBRUSH hBrush = (HBRUSH) brush.GetResourceHandle() ;
+ if (hBrush)
+ {
+ RECT rect;
+ rect.left = x; rect.top = y;
+ rect.right = x + width - 1;
+ rect.bottom = y + height - 1;
+ ::FillRect((HDC) dc.GetHDC(), &rect, hBrush);
+ }
+ }
+ width --; height --;
+ if (pen.Ok() && pen.GetStyle() != wxTRANSPARENT)
+ {
+ dc.DrawLine(x, y, x + width, y);
+ dc.DrawLine(x, y, x, y + height);
+ dc.DrawLine(x, y+height, x+width, y + height);
+ dc.DrawLine(x+width, y+height, x+width, y);
+ }
+}
+
+#endif // wxUSE_MEMORY_DC_DRAW_RECTANGLE
+
+void wxMemoryDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+{
+ // Set this to 1 to work around an apparent video driver bug
+ // (visible with e.g. 70x70 rectangle on a memory DC; see Drawing sample)
+#if wxUSE_MEMORY_DC_DRAW_RECTANGLE
+ if (m_brush.Ok() && m_pen.Ok() &&
+ (m_brush.GetStyle() == wxSOLID || m_brush.GetStyle() == wxTRANSPARENT) &&
+ (m_pen.GetStyle() == wxSOLID || m_pen.GetStyle() == wxTRANSPARENT) &&
+ (GetLogicalFunction() == wxCOPY))
+ {
+ wxDrawRectangle(* this, x, y, width, height);
+ }
+ else
+#endif // wxUSE_MEMORY_DC_DRAW_RECTANGLE
+ {
+ wxDC::DoDrawRectangle(x, y, width, height);
+ }