Png is in attachment.
I developed a wechat-like UI and test wxRichText auto-resize to fit their content without VScrollBar while resizing the top frame . On mac
and Ubuntu it worked fine . But on win10 it draw some jagged edges . I wonder where 's they comes from ?
Below is some part of the code :
----on top frame------------
Code: Select all
void myVSFrame::OnSize(wxSizeEvent& event)
{
//event.Skip();
wxSize c = GetSize();
wxVector<ChatPanel*>::iterator cp = cpsVec.begin();
for (cp = cpsVec.begin(); cp != cpsVec.end(); cp++){
wxSize ss = (*cp)->GetSize();
(*cp)->SetMinSize(wxSize(ss.x + (c.x-curFrameSize.x), (*cp)->zcp->new_height+30));
}
curFrameSize = c;
Layout();
}
I put a panel on each row in scrollwindow of top frame and in panel , I draw a wxRichText in boxsizer , when resize :
Code: Select all
void zcRoundRectPanel::OnSize(wxSizeEvent& event)
{
const auto w = txtCtrl->GetValue().length();
unsigned long totalLen = curFontSize * w;
printf("curFontSize=%d, totalLen=%lu\n", curFontSize, totalLen);
new_height = (totalLen / txtCtrl->GetSize().x + 1 ) * (curFontSize+3);
this->SetMinSize(wxSize(txtCtrl->GetSize().x , new_height));
Layout();
}
Code: Select all
void zcRoundRectPanel::OnPaint(wxPaintEvent &event)
{
wxSize curSize = GetSize();
//printf("round panel new size= %d, %d\n", curSize.x, curSize.y);
wxPaintDC dc(this);
PrepareDC(dc);
if (side_ % 2 > 0)
dc.SetBrush(*wxGREEN_BRUSH);
else
dc.SetBrush(*wxWHITE_BRUSH);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRoundedRectangle(0, 0, curSize.x, curSize.y-5, 5);
}
Best,