Calling Invalidate on Custom Control Causes Other Controls to Stop Rendering...

  • Thread starter Thread starter Alexander Jhin
  • Start date Start date
A

Alexander Jhin

I have this very basic Custom Control:
public class TestPanel : Panel
{
public TestPanel() : base()
{
this.SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.Opaque |
ControlStyles.UserPaint,
true);
}

protected override void OnPaint(PaintEventArgs e)
{
Invalidate(false);
base.OnPaint(e);
}
}
When I add it to a form, OTHER controls in the same form stop
rendering correctly (you can see the desktop where buttons should be,
text boxes only display text when you click on them, etc.)

Anyone know why this is happening? Thanks in advance.
 
protected override void OnPaint(PaintEventArgs e)
{
Invalidate(false);
base.OnPaint(e);
}
}

I may be wrong, but I think you are getting into a loop. Invalidate()
causes your OnPaint method to be called which calls Invalidate() which
causes your OnPaint method to be called which calls Invalidate() which
causes your OnPaint method to be called which calls Invalidate() which
causes your OnPaint method to be called which calls Invalidate() which
causes your OnPaint method to be called which calls Invalidate() which
causes your OnPaint method to be called which calls Invalidate() which
causes your OnPaint method to be called which calls Invalidate() which
causes your OnPaint method to be called which calls Invalidate() which
....


--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Back
Top