i know how to make use of events. i use events like 'paint' and 'onClick' all the time, as you could imagine. but how do i create my own? i want to trigger an event when ever the renderer i'm writing has completed another object.
I'm a bit of an inexperienced programmer myself, so I'm slightly cautious about making a suggestion, but I thought I might as well try to help...
If the renderer you're working with is a user control then making your own custom events isn't too complicated. Add a property to the form that looks like this.
public event EventHandler YourEventName;
Whenever you want that event to occur, the line
YourEventName(this, new EventArgs());
will raise the event. One more helpful tidbit is that I usually structure a raised event like so
if (YourEventName != null)
YourEventName(this, new EventArgs());
The reason I check for null is if I raise the event while the control is loading an error occurs.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.