dc.DrawText(_T("Blue in bottom right corner"), r.x, r.y);
r.Offset(0, TEXT_HEIGHT);
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(r.width, r.height));
+
+ // check that the area filled by the gradient is exactly the interior of
+ // the rectangle
+ r.x = 350;
+ r.y = 30;
+ dc.DrawText("The interior should be filled but", r.x, r.y);
+ r.y += 15;
+ dc.DrawText(" the red border should remain visible:", r.x, r.y);
+ r.y += 15;
+
+ r.width =
+ r.height = 50;
+ wxRect r2 = r;
+ r2.x += 60;
+ wxRect r3 = r;
+ r3.y += 60;
+ wxRect r4 = r2;
+ r4.y += 60;
+ dc.SetPen(wxPen(wxColour(255, 0, 0)));
+ dc.DrawRectangle(r);
+ r.Deflate(1);
+ dc.GradientFillLinear(r, wxColour(0,255,0), wxColour(0,0,0), wxNORTH);
+ dc.DrawRectangle(r2);
+ r2.Deflate(1);
+ dc.GradientFillLinear(r2, wxColour(0,0,0), wxColour(0,255,0), wxSOUTH);
+ dc.DrawRectangle(r3);
+ r3.Deflate(1);
+ dc.GradientFillLinear(r3, wxColour(0,255,0), wxColour(0,0,0), wxEAST);
+ dc.DrawRectangle(r4);
+ r4.Deflate(1);
+ dc.GradientFillLinear(r4, wxColour(0,0,0), wxColour(0,255,0), wxWEST);
}
void MyCanvas::DrawRegions(wxDC& dc)
SetPen(wxPen(colour, 1, wxSOLID));
SetBrush(wxBrush(colour));
if(nDirection == wxEAST)
- DoDrawRectangle(rect.GetRight()-x-xDelta, rect.GetTop(),
+ DoDrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(),
xDelta, rect.GetHeight());
else //nDirection == wxWEST
DoDrawRectangle(rect.GetLeft()+x, rect.GetTop(),
DoDrawRectangle(rect.GetLeft(), rect.GetTop()+y,
rect.GetWidth(), yDelta);
else //nDirection == wxSOUTH
- DoDrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta,
+ DoDrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta+1,
rect.GetWidth(), yDelta);
}
}
SetPen(wxPen(colour, 1, wxSOLID));
SetBrush(wxBrush(colour));
if(nDirection == wxEAST)
- DrawRectangle(rect.GetRight()-x-xDelta, rect.GetTop(),
+ DrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(),
xDelta, rect.GetHeight());
else //nDirection == wxWEST
DrawRectangle(rect.GetLeft()+x, rect.GetTop(),
DrawRectangle(rect.GetLeft(), rect.GetTop()+y,
rect.GetWidth(), yDelta);
else //nDirection == wxSOUTH
- DrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta,
+ DrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta+1,
rect.GetWidth(), yDelta);
}
}