diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 64b2113ebf..ddc158258a 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6139,9 +6139,18 @@ void wxGrid::GetTextBoxSize( const wxDC& dc, size_t i; for ( i = 0; i < lines.GetCount(); i++ ) { - dc.GetTextExtent( lines[i], &lineW, &lineH ); - w = wxMax( w, lineW ); - h += lineH; + if ( lines[i].empty() ) + { + // GetTextExtent() would return 0 for empty lines, but we still + // need to account for their height. + h += dc.GetCharHeight(); + } + else + { + dc.GetTextExtent( lines[i], &lineW, &lineH ); + w = wxMax( w, lineW ); + h += lineH; + } } *width = w;