Object sender and eventargs E

Source: Internet
Author: User
Sender is the event source.
For example, if you press the button, the sender is the button.

Another example is textboxchange. Sender is the textbox. In event processing, sender can be used to replace textbox.
For example:
(Sender as textbox). Text = "fdsaewfsda ";

WinfromProgramMost of them are controls.

Eventargs is an event parameter.
// Parameters passed in for this event, for example, you click the form with the mouse
Then eventargs will include the Click location and so on.
It helps you process events

The evenghandler delegate will tell the main program that something has happened: this event is caused by the object-type sender, E

The content of the incident.

Therefore, the event handler function in the program depends on this implementation: for example, if you click a button, how does the program know?

Which function should be used to handle this action? Then the eventhandler will tell the program: "button1 (sender) is clicked

(E). Please call the corresponding processing function ". Of course, who this function is and what it is to do is written by yourself.

Further, this process is actually: Your action is captured by windows, and Windows sends this action as a system message to the program.

Order (you can see the message structure), the program continuously extracts messages from its own message queue, and find the corresponding processing in the message loop

In this case, something similar to sender and E in the message structure plays a role for the Bootstrap program to use the correct processing function.

Finally, this sender and E and their entire processing method are just another manifestation of the Windows message mechanism.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.