Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implement User Input 98-362 Windows Development Fundamentals LESSON 2.4A.

Similar presentations


Presentation on theme: "Implement User Input 98-362 Windows Development Fundamentals LESSON 2.4A."— Presentation transcript:

1 Implement User Input 98-362 Windows Development Fundamentals LESSON 2.4A

2 98-362 Windows Development Fundamentals LESSON 2.4A Lesson Overview How do Windows ® Forms applications process user input? In this lesson, you will learn about:  Keyboard input  Mouse input  Handling user input events

3 98-362 Windows Development Fundamentals LESSON 2.4A Anticipatory Set  Explain how events (and event handlers) work in a Windows Forms application.

4 98-362 Windows Development Fundamentals LESSON 2.4A Windows Messages  Signals sent to an application by the operating system in response to user input.  — In a Windows Forms application, these messages are processed and used to raise events.  Through event handlers, an application can process user input.  — The methods that process Windows messages can be overridden, allowing messages to be intercepted before an event is raised.

5 98-362 Windows Development Fundamentals LESSON 2.4A Keyboard Input  Three events associated with keyboard input occur in this order: 1.KeyDown: is raised once when a keyboard key is pressed. 2.KeyPress: is raised continuously as the key is held down. 3.KeyUp: is raised once when a keyboard key is released.  The event handler for KeyPress receives a KeyPressEventArgs parameter, which specifies the character specified by the user.  — For example, SHIFT-R on the keyboard would specify an uppercase R in the KeyPressEventArgs parameter; the R key alone would specify a lowercase R.  The event handlers for KeyDown and KeyUp receive a KeyEventArgs which specifies the physical key pressed (for example, the R key), the Modifiers property (SHIFT, CTRL, or ALT), and the KeyData property (the key code plus a modifier).

6 98-362 Windows Development Fundamentals LESSON 2.4A Mouse Input  There are many events associated with input in a Windows Forms application.  — See the “User Input Reference” handout for a detailed list.  In a standard mouse click, four events are raised in this order: 1.MouseDown: is raised when the mouse pointer is over the control and the user presses a mouse button. 2.Click: is raised when the mouse button is released. Note: the Click event is not specific to mouse input—it is also used when a control is “clicked” some other way, such as pressing Enter when the control has focus. 3.MouseClick: occurs when the user clicks the control with the mouse. 4.MouseUp: is raised when the mouse pointer is over the control and the user releases a mouse button.

7 98-362 Windows Development Fundamentals LESSON 2.4A Lesson Review  Complete the “User Input Review” Student Activity.


Download ppt "Implement User Input 98-362 Windows Development Fundamentals LESSON 2.4A."

Similar presentations


Ads by Google