Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture Set 13 Drawing Mouse and Keyboard Events Part B – Mouse and Keyboard Events.

Similar presentations


Presentation on theme: "Lecture Set 13 Drawing Mouse and Keyboard Events Part B – Mouse and Keyboard Events."— Presentation transcript:

1 Lecture Set 13 Drawing Mouse and Keyboard Events Part B – Mouse and Keyboard Events

2 Slide 2 Objectives Create event handlers for mouse events Determining the position of the mouse Determining which mouse button was clicked Learning when events, such as MouseClick, MouseDown, MouseEnter, MouseHover, and MouseMove fire Create event handlers for keyboard events Determining which keyboard button was clicked Learning when events, such as KeyUp, KeyDown, and KeyPress fire Learn about keyboard properties such as KeyChar, KeyData, and KeyCode and KeyValue

3 Slide 3 Add more material on mouse events THIS SLIDE SET NOT YET COMPLETE Get material from Ch 13 of Ekedahl original version of text Get material on keyboard events from Dietel, pp 513ff

4 Slide 4 Introduction to Mouse Events The MouseClick event fires when the end user clicks the mouse on a form The MouseDown and MouseUp events fire when the end user presses and releases the mouse, respectively The MouseEnter and MouseLeave events fire as the mouse enters and leaves a control instance The MouseMove event fires whenever the end user moves the mouse

5 Slide 5 Determining Mouse Information In graphical applications, it is necessary to get the position of the mouse to determine where to draw a shape It is often necessary to determine which mouse button was clicked The state of modifier keys (Ctrl, Alt, Shift) must also be determined It is often necessary to determine whether the mouse wheel was scrolled

6 Slide 6 The MouseEventArgs Class The MouseEventArgs class is used to get information about the mouse Use the Button property to determine which mouse button was clicked Use the X and Y properties to determine the position of the mouse Use the Delta property to determine the number of detents the mouse wheel was scrolled


Download ppt "Lecture Set 13 Drawing Mouse and Keyboard Events Part B – Mouse and Keyboard Events."

Similar presentations


Ads by Google