I have been programming simple C# application for a short time. I still do not understand the eventArgs e parameter, as in 'Form1_Paint(object sender, PaintEventArgs e)' Will somebody please explain this to me ?
It is the Paint Event Arguments. This exposes you a very useful "method", the e.Graphics, that you can paint (text, pictures, etc) on the form. You can paint anything.
Each time you resize the form, the paint sub will be triggered and everything will be paint again. If you want manually to do this, simply call the .refresh method of the form.
When creating a callback method that needs parameters passed to it, you can either make it parameter-rich (tons of specialized parameters), or you can pass an object which acts as a container for the specialized parameters, which is what Microsoft did.
The fact that they're all named "e" is just a convention.
Note that PaintEventArgs inherits from EventArgs, so it gets a fair amount of plumbing for free.
Chip H.
____________________________________________________________________ If you want to get the best response to a question, please read FAQ222-2244 first
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.