unicorn
unicorn

Reputation: 867

can't invoke paint

I created my own control and overwritten the onpaint event, the problem is that the paint event stopped working

Any ideas why? And how to restore it?

Upvotes: 0

Views: 517

Answers (2)

Mark Lakata
Mark Lakata

Reputation: 20838

Maybe the control is obscured. I had a similar problem, and the problem was that the form in the Designer view was bigger than the actual form when the application was run. My custom control had anchors on all sides, and when the main form was reduced in size, the custom control went to zero size (actually negative I guess).

In this mode, the OnPaint override nor a delegate assigned to the Paint event is not called at all.

Maximize your form and make sure that you didn't accidentally reduce the size to zero!

Upvotes: 0

Henk Holterman
Henk Holterman

Reputation: 273264

Let's have a telepathic guess here:

You forgot to call base.OnPaint(...) inside your override. Meaning that the base functionality is no longer invoked.

Upvotes: 4

Related Questions