If I set a Windows Forms CheckBox.Checked = true, and it’s already true, does the widget redraw itself?
I would expect not, if it’s just directly setting the value as there will be no change. But I can imagine that there might be some magic code in there that sets a dirty flag upon setting the value, regardless of what it already was.
I just want to know if I should be doing stuff like this to prevent extra refreshes:
if (TheBox.Checked != checkBool)
{
TheBox.Checked = checkBool;
}
If the Checked value doesn’t change, the
Paintevent doesn’t fire, so I assume that means it isn’t redrawing itself. You can see this by handling theCheckBox.Paintevent and putting a breakpoint in the handler method.