private void OnPerformRefresh()
{
// If we still need to perform the refresh
if (_refresh)
{
// Perform the requested refresh now to force repaint
Refresh();
// If the layout is still dirty after the refresh
if (_layoutDirty)
{
// Then non of the control is visible, so perform manual request
// for a layout to ensure that child controls can be resized
PerformLayout();
// Need another repaint to take the layout change into account
Refresh();
}
// Refresh request has been serviced
_refresh = false;
_refreshAll = false;
}
}