Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the e. !!!!

Status
Not open for further replies.

JasonSummers

Programmer
Sep 11, 2002
26
US
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
 
Thank you Tipgiver and chiph. The responses helped clear up things a little better that Microsofts explanations.

Thanks,
Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top