Avoid flicker when size of wxStaticText doesn't change in wxMSW
Don't do anything if wxStaticText::DoSetSize() is called with the same size as the control already uses, this only results in flicker. Closes #17075.
This commit is contained in:
@@ -120,9 +120,17 @@ wxSize wxStaticText::DoGetBestClientSize() const
|
||||
|
||||
void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)
|
||||
{
|
||||
// Keep track of the size before so we can see if it changed
|
||||
const wxSize sizeBefore = GetSize();
|
||||
|
||||
// note: we first need to set the size and _then_ call UpdateLabel
|
||||
wxStaticTextBase::DoSetSize(x, y, w, h, sizeFlags);
|
||||
|
||||
// Avoid flicker by not refreshing or updating the label if the size didn't
|
||||
// change.
|
||||
if ( sizeBefore == GetSize() )
|
||||
return;
|
||||
|
||||
#ifdef SS_ENDELLIPSIS
|
||||
// do we need to ellipsize the contents?
|
||||
long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE);
|
||||
|
Reference in New Issue
Block a user