Fix auto-sizing multiline wxGrid column labels with empty lines
Account for the empty lines explicitly by reserving enough vertical space for them, as wxDC::GetTextExtent() wouldn't do it as it simply returns 0 for empty strings. Closes #18028.
This commit is contained in:
@@ -6138,11 +6138,20 @@ void wxGrid::GetTextBoxSize( const wxDC& dc,
|
|||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
for ( i = 0; i < lines.GetCount(); i++ )
|
for ( i = 0; i < lines.GetCount(); i++ )
|
||||||
|
{
|
||||||
|
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 );
|
dc.GetTextExtent( lines[i], &lineW, &lineH );
|
||||||
w = wxMax( w, lineW );
|
w = wxMax( w, lineW );
|
||||||
h += lineH;
|
h += lineH;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*width = w;
|
*width = w;
|
||||||
*height = h;
|
*height = h;
|
||||||
|
Reference in New Issue
Block a user