While this works as hoped on OS-X, drawing directly using the wxDC, I understand that for this to also work on Linux that I need to use a wxGraphicsContext when drawing.
However, when testing on either OS-X or Linux, I find that RoundedRectangles do not have their rounded corners when using a wxGraphicsContext.
Here is my coded attempt, and a screenshot of what I'm seeing.
Any suggestions much appreciated!
Code: Select all
void DrawMap(wxWindowDC &dc)
{
#define MY_ALPHA 100
wxColour myColour(60, 60, 60, MY_ALPHA);
wxDouble x = 20.0;
dc.Clear();
dc.SetTextForeground(*wxBLUE);
dc.DrawText( "just a very long text string under rectangles", 5, 100);
#define ROUND_RECT_DETAILS (x, 20.0, 60.0, 200.0, -0.25)
wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
if(gc) {
gc->SetPen(myColour);
gc->SetBrush(myColour);
gc->DrawRoundedRectangle ROUND_RECT_DETAILS;
x += 80.0;
wxGraphicsPath path = gc->CreatePath();
path.AddRoundedRectangle ROUND_RECT_DETAILS;
x += 80.0;
gc->FillPath(path);
gc->StrokePath(path);
delete gc;
}
dc.SetPen(myColour);
dc.SetBrush(myColour);
dc.DrawRoundedRectangle ROUND_RECT_DETAILS;
// JUST LABEL THE 3 ROUNDED RECTANGLES
dc.SetTextForeground(*wxBLACK);
x = 25.0;
dc.DrawText( "gc->DRR", x, 230);
x += 80.0;
dc.DrawText( "path.ARR", x, 230);
x += 80.0;
dc.DrawText( "dc.DRR", x, 230);
}