I want to draw a rectangle with rounded corners on a wxPanel.
As shown below, i am unable to get it transparent. The white area should be transparent. The grey area is a bitmap and below it there is a wxPanel background. My code for drawing bitmap (wxBitmap) is
Code: Select all
wxMemoryDC temp;
bitmap.Create(kWidth, kHeight);
temp.SelectObject(bitmap);
temp.SetBackground(*wxWHITE_BRUSH);
temp.Clear();
temp.SetPen(wxPen(wxColor(80, 80, 80), 1));
temp.SetBrush(*wxTRANSPARENT_BRUSH);
temp.DrawRectangle(0, 0, kWidth, kHeight);
temp.SetBrush(wxBrush(backgroundColor));
temp.DrawRoundedRectangle(0, 0, kWidth, kHeight, kRadius);
Code: Select all
void draw(wxDC& dc, wxPoint mousePosition)
{
wxMemoryDC temp;
temp.SelectObject(bitmap);
dc.Blit(wxPoint(kLeft, kTop), temp.GetSize(), &temp, wxPoint(0, 0), wxCOPY, true);
}
Thanks
Vinayak