can't invoke paint
I created my own control and overwritte开发者_StackOverflow中文版n the onpaint event, the problem is that the paint event stopped working
Any ideas why? And how to restore it?
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.
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!
精彩评论