I recently had the need to write a version of the Windows NumericUpDown control which could highlight whether a value was mandatory. It needed to do this by changing the back co
The above method did not work out for me. My workaround was:
private void smartRefresh()
{
if (oldBackColor != BackColor) {
oldBackColor = BackColor;
Hide();
Application.DoEvents();
Show();
Application.DoEvents();
}
}
With a private member oldBackColor.
Now it always shows correctly but does not flicker.
Addendum: I think some part of the Control doesn't get painted at all (I consider it a bug) as the "mispainted" bos around it is not uniformly colored an somtimes traces of the window that was there before can be seen.