Corrected display for empty lines in text control.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2002-07-14 17:08:19 +00:00
parent 29e4a1901a
commit b8c140b89f
2 changed files with 38 additions and 18 deletions

View File

@ -63,10 +63,20 @@ const wxString punct = " ,.-;:!?";
void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
{
long width, height ;
if (paragraph.Length() == 0)
{
// empty line
dc.GetTextExtent( "H", &width, &height );
y += height;
return;
}
int x = 0 ;
int i = 0 ;
long width, height ;
bool linedrawn = true;
while( paragraph.Length() > 0 )
{
@ -153,19 +163,19 @@ void wxStaticText::OnDraw( wxDC &dc )
while (i < text.Length())
{
if (text[i] == 13 || text[i] == 10)
{
DrawParagraph(dc, paragraph,y);
paragraph = "" ;
}
else
{
if (text[i] == 13 || text[i] == 10)
{
DrawParagraph(dc, paragraph,y);
paragraph = "" ;
}
else
{
paragraph += text[i];
}
++i;
}
if (paragraph.Length() > 0)
DrawParagraph(dc, paragraph,y);
DrawParagraph(dc, paragraph,y);
}
void wxStaticText::OnPaint( wxPaintEvent &event )

View File

@ -63,10 +63,20 @@ const wxString punct = " ,.-;:!?";
void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
{
long width, height ;
if (paragraph.Length() == 0)
{
// empty line
dc.GetTextExtent( "H", &width, &height );
y += height;
return;
}
int x = 0 ;
int i = 0 ;
long width, height ;
bool linedrawn = true;
while( paragraph.Length() > 0 )
{
@ -153,19 +163,19 @@ void wxStaticText::OnDraw( wxDC &dc )
while (i < text.Length())
{
if (text[i] == 13 || text[i] == 10)
{
DrawParagraph(dc, paragraph,y);
paragraph = "" ;
}
else
{
if (text[i] == 13 || text[i] == 10)
{
DrawParagraph(dc, paragraph,y);
paragraph = "" ;
}
else
{
paragraph += text[i];
}
++i;
}
if (paragraph.Length() > 0)
DrawParagraph(dc, paragraph,y);
DrawParagraph(dc, paragraph,y);
}
void wxStaticText::OnPaint( wxPaintEvent &event )