469,579 Members | 1,344 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

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

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.
Jul 21 '05 #1
1 1537
On 10 Oct 2004 01:36:08 -0700, Alexander Jhin wrote:
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.
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by One Handed Man \( OHM - Terry Burns \) | last post: by
17 posts views Thread by SamSpade | last post: by
11 posts views Thread by Nick Gilbert | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.