fix the size of bitmaps we create (bug 1851598)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -843,33 +843,23 @@ wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr)
|
|||||||
|
|
||||||
wxBitmap BitmapComboBoxWidgetsPage::CreateBitmap(const wxColour& colour)
|
wxBitmap BitmapComboBoxWidgetsPage::CreateBitmap(const wxColour& colour)
|
||||||
{
|
{
|
||||||
int ch = m_combobox->GetBitmapSize().y;
|
const int w = 10,
|
||||||
int h0 = ch - 5;
|
h = 10;
|
||||||
|
|
||||||
long w = ch;
|
|
||||||
long h = ch;
|
|
||||||
|
|
||||||
if ( w <= 0 )
|
|
||||||
w = h0 - 1;
|
|
||||||
if ( h <= 0 )
|
|
||||||
h = h0;
|
|
||||||
if ( h > ch )
|
|
||||||
h = ch;
|
|
||||||
|
|
||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
wxBitmap bmp(w,h);
|
wxBitmap bmp(w, h);
|
||||||
dc.SelectObject(bmp);
|
dc.SelectObject(bmp);
|
||||||
|
|
||||||
// Draw transparent background
|
// Draw transparent background
|
||||||
wxColour magic(255,0,255);
|
wxColour magic(255, 0, 255);
|
||||||
wxBrush magicBrush(magic);
|
wxBrush magicBrush(magic);
|
||||||
dc.SetBrush(magicBrush);
|
dc.SetBrush(magicBrush);
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
dc.DrawRectangle(0,0,bmp.GetWidth(),bmp.GetHeight());
|
dc.DrawRectangle(0, 0, w, h);
|
||||||
|
|
||||||
// Draw image content
|
// Draw image content
|
||||||
dc.SetBrush(wxBrush(colour));
|
dc.SetBrush(wxBrush(colour));
|
||||||
dc.DrawCircle(h/2,h/2+1,(h/2));
|
dc.DrawCircle(h/2, h/2+1, h/2);
|
||||||
|
|
||||||
dc.SelectObject(wxNullBitmap);
|
dc.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user