Code: Select all
wxArrayString PrintPanel::GetWrappedText(wxDC *dc, wxString str, int Length, bool bySpace)
{
wxArrayString aryStr;
int textwidth = 0, textheight = 0;
int Index = 0;
wxString FullStr = str;
do
{
dc->GetTextExtent(str, &textwidth, &textheight);
if(textwidth>Length)
{
Index = 0;
do
{
str = str.Left(str.Length()-1);
Index++;
dc->GetTextExtent(str, &textwidth, &textheight);
wxLogDebug(wxT("GetWrappedText=%s, textwidth=%i"), str.c_str(), textwidth);
if(str == wxT("") && str == wxEmptyString)
break;
wxString c = wxString(str.Last());
if(!bySpace){
if(textwidth<Length /*&& c == wxT(" ")*/)
break;
}
else{
if(textwidth<Length && c == wxT(" "))
break;
}
}while(1);
aryStr.Add(str);
str = FullStr.Right(Index);
}
else
break;
}while(1);
aryStr.Add(str);
return aryStr;
}
Все бы ничего да уже при небольшом количестве на страницу. Начинаются жуткие тормоза при отрисовке. Скролить просто невозможно. Помогите разрешить проблему.
wxBufferedDC в OnPaint попробовал либо я что-то не так понял либо тоже не работает