From b14c14ff369c78450e62b953f1115c292fed1533 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 17 Feb 2000 11:04:26 +0000 Subject: [PATCH] Added demo of strange rectangle behaviour git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6107 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/drawing/drawing.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index a5e06a3925..47a069d5d0 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -696,6 +696,37 @@ void MyCanvas::DrawDefault(wxDC& dc) dc.DrawLine(400, 270, 400, 310); dc.DrawLine(300, 300, 410, 300); + // Added by JACS to demonstrate bizarre behaviour. + // With a size of 70, we get a missing red RHS, + // and the hight is too small, so we get yellow + // showing. With a size of 40, it draws as expected: + // it just shows a white rectangle with red outline. + int totalWidth = 70; + int totalHeight = 70; + wxBitmap bitmap2(totalWidth, totalHeight); + + wxMemoryDC memdc2; + memdc2.SelectObject(bitmap2); + + memdc2.SetBackground(*wxWHITE_BRUSH); + + // Draw a yellow rectangle filling the bitmap + memdc2.SetPen(wxPen(wxColour(255, 255, 0), 1, wxSOLID)); + memdc2.SetBrush(wxBrush(wxColour(255, 255, 0), wxSOLID)); + memdc2.DrawRectangle(0, 0, totalWidth+2, totalHeight+2); // Just to make sure! + + // Now draw a white rectangle with red outline. It should + // entirely eclipse the yellow background. + memdc2.SetPen(*wxRED_PEN); + memdc2.SetBrush(*wxWHITE_BRUSH); + + memdc2.DrawRectangle(0, 0, totalWidth, totalHeight); + + memdc2.SelectObject(wxNullBitmap); + memdc2.SetPen(wxNullPen); + memdc2.SetBrush(wxNullBrush); + + dc.DrawBitmap(bitmap2, 500, 270); } void MyCanvas::DrawText(wxDC& dc) -- 2.45.2