Clear out an OnPaint delegate?

  • Thread starter Thread starter Michael A. Covington
  • Start date Start date
M

Michael A. Covington

Is there a simple way to empty out the Paint delegate (which is a list of
method calls) before adding something to it?

I'm envision a large, casually designed, experimental program in which
various menu choices will each put a different routine into OnPaint, and
each of them would want to clear out the previously added ones first,
without necessarily knowing what they are.

I can't use assignment (=) with this.Paint, but I can use += and -= (and
apparently nothing else!).
 
Michael A. Covington said:
Is there a simple way to empty out the Paint delegate (which is a list of
method calls) before adding something to it?

I'm envision a large, casually designed, experimental program in which
various menu choices will each put a different routine into OnPaint, and
each of them would want to clear out the previously added ones first,
without necessarily knowing what they are.

I can't use assignment (=) with this.Paint, but I can use += and -= (and
apparently nothing else!).

I would suggest that you add a single delegate to the Paint event, but
have another delegate that can be set by the menu choices - and the
Paint event delegate just calls the other one.
 
Back
Top