strange UI on Win10 platform (none HDPI compile)

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Feb 22, 2021 8:42 am

strange UI on Win10 platform (none HDPI compile)

Post by woailinux » Fri Mar 05, 2021 1:29 am


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)
    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;

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));

----- besides, OnPaint of zcRoundRectPanel is like this:

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);
    if (side_ % 2 > 0)
    dc.DrawRoundedRectangle(0, 0, curSize.x, curSize.y-5, 5);
Any advices and anwsers is welcome and thanks a lot !

Last edited by catalin on Fri Mar 05, 2021 6:12 am, edited 1 time in total.
Reason: code tags

Post Reply