Avoid asserts when drawing zero-size wxStaticBox in wxMSW
If a wxStaticBox is rendered, but has zero size in either dimension we generate assert failures when creating the bitmap. Check for these conditions and just do not render if this is the case. Closes #17288.
This commit is contained in:
parent
231c9c7168
commit
ec824f7e8d
@ -507,6 +507,11 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
::GetClientRect(GetHwnd(), &rc);
|
||||
wxPaintDC dc(this);
|
||||
|
||||
// No need to do anything if the client rectangle is empty and, worse,
|
||||
// doing it would result in an assert when creating the bitmap below.
|
||||
if ( !rc.right || !rc.bottom )
|
||||
return;
|
||||
|
||||
// draw the entire box in a memory DC
|
||||
wxMemoryDC memdc(&dc);
|
||||
wxBitmap bitmap(rc.right, rc.bottom);
|
||||
|
Loading…
Reference in New Issue
Block a user