Standard event handler type
In the FCL class library, all events are described using a single delegate type that has a fixed signature with two parameters and does not return a value:
public delegate void & lt; .get_name & gt; (object sender, & lt; parameter_type & gt; args);
The first delegate parameter specifies a reference to the object that initiates the event. The second argument to args specifies a reference to the parameters associated with the event that occurred, passed to the handler. The type of this parameter should be specified by the EventArgs event parameter description class, which is contained in the .Net Framework or derived from it by the class (for example: PaintEventArgs, MouseEventArgs, etc.). If no additional parameters are passed to the handler, then simply specify the EventArgs class, passing null as the actual parameter when the event is triggered.
User interaction with the application
The user interaction is best described in the form of various events that initiate the EA (based on OS messages about the user's actions) and to which the application responds (processes). The most commonly used events are:
How to ...
Tired of looking for a solution?Get Your ESSAY Now!
• Click - click the left mouse button & quot; in the window area;
• Doubleclick - two clicks of the left mouse button & quot; with an interval less than a certain predetermined value;
• KeyDown - pressing the key of the keyboard;
• KeyPress - pressing and releasing the key, as a result of which a symbol is sent to the program;
• Validating - checking the entered data;
• Paint - you need to redraw the client area.
Events from the & quot; mouse & quot; device, such as Click, Doubleclick,
MouseDown, MouseUp, MouseEnter, MouseLeave, and MouseHover are associated with various user actions over the EC area.
The EventArgs type is passed for the Click and Doubleclick events, and for the MouseDown and MouseUp events, a parameter of type MouseEventArgs is passed, which contains such useful information (class properties) as the current cursor coordinates in the client area, the description of the pressed button, the number of button presses, the number of clicks while rotating the mouse wheel & quot;.
Keyboard events work similarly: the amount of information transmitted depends on the type of event being processed. For example, for a KeyPress event, the KeyPressEventArgs parameter is passed to the event processing method, which contains the KeyChar property, a value of type char that represents the character of the key being pressed.
The Handled property is used to determine whether the event was processed. If the Handled property is set to true, then this event will not be passed to the OS for standard processing. KeyDown and KeyUp events are better suited if you want to get more information about the key pressed, because they get the KeyEventArgs parameter. The KeyEventArgs parameter includes properties about which keys Ctrl, Alt, or Shift were pressed. The KeyCode property returns the value of the Keys enumeration, which points to the virtual code of the key pressed. Unlike KeyPressEventArgs.KeyChar, the KeyCode property passes the virtual code of any keyboard key pressed, not the alphanumeric character of the key.
The KeyData property returns the value of the Keys enumeration, as well as the status of the additional keys. For example, if you pressed Shift or Ctrl. The KeyValue property contains the integer value of the Keys enumeration. The Modifiers property contains Keys values that correspond to the codes of the additional keys that are pressed. If several keys were pressed, they are combined using the OR operation. The events associated with the key are initiated in the following order: 1) KeyDown; 2) KeyPress; 3) KeyUp.
Validating, Validated, Enter, Leave, GotFocus, and LostFocus events are related to getting the input focus (when the EA becomes active) or losing focus. This happens when the user presses the Tab key to go to the desired EC or selects this item using the & quot; mouse & quot ;. It seems that the events Enter, Leave, GotFocus and LostFocus are very similar in performance. The GotFocus and LostFocus events are lower-level events that are associated with WM_SETFOCUS and WM_KILLFOCUS OS messages. It is usually better to use the Enter and Leave events. Validating and Validated events occur when checking the value in the EC. They receive a parameter of type CancelEventArgs. Using it, you can interrupt the following events if you set the Cancel property to true. If the developer specifies his own verification code for the entered values and the test was unsuccessful, then you can set the Cancel property to true and the EC will not lose focus (it will not go to the next form's EC). The Validating event occurs during validation, and the Validated event occurs after the test is run. These events occur in the following order: 1) Enter; 2) GotFocus; 3) Leave; 4) Validating; 5) Validated; 6) LostFocus.
Ready to make your order?Get your great paper now
Price Plan & Our Features
- Free Outline
- Free Formatting
- Free Title page
- Free Reference Page
- Free Revisions
- Free Submission by Chapters
- Free Plagiarism Report
- Free Customer Service
- 1 – page abstract
- VIP Support
- Expedited delivery
- Essay outline
Also We Can Offer!
- Argumentative essay
- Best college essays
- Buy custom essays online
- Buy essay online
- Cheap essay
- Cheap essay writing service
- Cheap writing service
- College essay
- College essay introduction
- College essay writing service
- Compare and contrast essay
- Custom essay
- Custom essay writing service
- Custom essays writing services
- Death penalty essay
- Do my essay
- Essay about love
- Essay about yourself
- Essay help
- Essay writing help
- Essay writing service reviews
- Essays online
- Fast food essay
- George orwell essays
- Human rights essay
- Narrative essay
- Pay to write essay
- Personal essay for college
- Personal narrative essay
- Persuasive writing
- Write my essay
- Write my essay for me cheap
- Writing a scholarship essay