Timer, Animation Responding to Mouse & Keyboard Lab 7 7 McGraw-Hill© 2006 The McGraw-Hill Companies, Inc. All rights reserved.

Slides:



Advertisements
Similar presentations
Intro to Computers!.
Advertisements

Windows Basics: The Mouse. The Mouse Before you can explore the Desktop and Taskbar, you must know how to use your mouse. Your mouse is a pointing device.
DEVELOPING ICT SKILLS PART -TWO
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
Online Calculator Basic Word Processing Skills Computer Keyboard Skills Computer Mouse Skills Basic Computer Terminology Computer Mouse Skills “I really.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
Sketchify Tutorial Defining Interaction and Logic in Sketchify sketchify.sf.net Željko Obrenović
Chapter 2 –Visual Basic, Controls, and Events
XP Exploring the Basics of Microsoft Windows XP1 Exploring the Basics of Windows XP.
Chapter 1: An Introduction to Visual Basic.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Event Handling Events and Listeners Timers and Animation.
Events. Events Single Event Handlers Click Event Mouse Events Key Board Events Create and handle controls in runtime Outline.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
XP Tutorial 8 New Perspectives on JavaScript, Comprehensive1 Working with the Event Model Creating a Drag-and-Drop Shopping Cart.
Sketchlet Tutorial Defining Interaction and Logic in Sketchlet sketchlet.sf.net Željko Obrenović obren.info/
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. M I C R O S O F T ® Animating and Using Multimedia Effects Lesson 10.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
CSCI 3327 Visual Basic Chapter 10: Windows Forms GUI: A Deeper Look UTPA – Fall 2011.
COMPUTER PROGRAMMING I Objective 8.03 Apply Animation and Graphic Methods in a Windows Form (4%)
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
Tutorial 1: An Introduction to Visual Basic.NET1 Tutorial 1 An Introduction to Visual Basic.NET.
Sketchify Tutorial Defining Interaction and Logic in Sketchify sketchify.sf.net Željko Obrenović
Lecture 4 Advanced Topics Devi, Erick, Reddy. » Declare dynamic component, an example: ˃Create a button Button newBtn = new Button(); ˃Create an array.
Adding User Interactivity – Lesson 51 Adding User Interactivity Lesson 5.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Assignment #1 Advanced Computer Programming.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Lecture Set 13 Drawing Mouse and Keyboard Events Part B – Mouse and Keyboard Events.
Introduction to Visual Basic.NET Your First Visual Basic.NET Application.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
滑鼠事件 & 鍵盤事件. 滑鼠事件 (MouseDown,MouseMove,MouseUp) Public Class Form1 Dim drag As Boolean = False ' 宣告 drag 變數, 用來記錄是否可拖曳 Private Sub Form1_Load(ByVal sender.
Lecture 6: Introduction to Graphical User Interfaces (GUIs)
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
COM148X1 Interactive Programming Lecture 7. Topics Today HCI Event Handling.
BIM211 – Visual Programming Interacting with Users Graphics 1.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
7th Meeting TYPE and CLICK. Keyboard Keyboard, as a medium of interaction between user and machine. Is a board consisting of the keys to type a sentence.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Lab 10 Slides.
Practical Programming COMP153-08S Lecture: Repetition.
Chapter 31 Fundamentals of Programming in Visual Basic (VB) Visual Basic Events Simple Statement.
 2002 Prentice Hall. All rights reserved. 1 Outline Mouse Event Handling Keyboard Event Handling Graphical User Interface Concepts:
CIS 338: Events Dr. Ralph D. Westfall April, 2011.
 ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These.
Implement User Input Windows Development Fundamentals LESSON 2.4A.
Welcome to introduction to Windows April 9, 2011 Facilitator: Joyce Gerald Director of Title I Jasper County School District.
Done By: Huraiz AlGaoud. The mouse Mouse: It is a handheld pointing device that lets you select or move items on your screen. Mouse pad: provides a smooth.
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
Dr. Abraham Professor UTPA Graphical User Interface.
Visual Basic Fundamental Concepts
Chapter 1: An Introduction to Visual Basic .NET
Introduction to Event-Driven Programming
Validating User Input Lesson 5.
Event-driven programming
JavaScript and Events.
Visual Basic Properties, Methods and Events
Visual Basic..
Project Design, Forms and Buttons
JavaScript and Events CS Programming Languages for Web Applications
CS7026 jQuery Events.
JavaScript and Events CS Programming Languages for Web Applications
CPT 450 Computer Graphics 3rd Lecture.
Presentation transcript:

Timer, Animation Responding to Mouse & Keyboard Lab 7 7 McGraw-Hill© 2006 The McGraw-Hill Companies, Inc. All rights reserved.

The Timer Control A control that enables you to generate response based on the value of the computer’s internal clock. Properties: Interval: Specify the frequency of timer events (measured in milliseconds = 1/1000 second). Enabled : False/True Events: Tick: The only event where you place the code for the timer control.

The Mouse The mouse is an object that is attached to the computer allowing the user to interact with the machine. The mouse can accomplish some tasks that are not normally available on the other.

The Mouse….Cont The mouse is equipped with: two, three, or more buttons. When a mouse has two buttons, one is usually located on the left and the other is located on the right. When a mouse has three buttons, one usually is in the middle of the other two. A mouse can also have a round object referred to as a wheel.

The Mouse….Cont The mouse is used to select a point or position on the screen. To use the mouse, the user would press either the left, the middle (if any), or the right button. If the user presses the left button once, this action is called Click. If the user presses the right mouse button, the action is referred to as Right-Click. If the user presses the left button twice and very fast, the action is called Double-Click. If the mouse is equipped with a wheel, the user can position the mouse pointer somewhere on the screen and roll the wheel. This usually causes the document or page to scroll up or down, slow or fast, depending on how it was configured.

Mouse Enter Event When positioninig the mouse on a control, the control fires a MouseEnter event. This event is initiated as follows: Private Sub ControlName_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter This event let you know that the mouse was positioned on a control.

Mouse Move Event Whenever the mouse is being moved on top of a control, MouseMove event is sent. Private Sub Object_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove End Sub Tracking the mouse: e.X >>x position e.Y >> y position

Mouse Hover Event If the user positions the mouse on a control and hovers over it, a MouseHover event is fired. Private Sub Object_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseHover End Sub

Mouse Down Event Occurs when the user press down one of the mouse buttons while it is positioned on a control. Private Sub Object_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown End Sub Note: e.button (specify which button is clicked)

Mouse Up Event After pressing a mouse button, while the button is being released, a button-up message is sent. Private Sub Object_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp End Sub

Mouse Wheel Event If a mouse is equipped with a wheel, when the user presses the wheel or starts turning it, a MouseWheel event is fired. You can use this event to specify what would happen if or when the user decides to use the wheel. Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseWheel End Sub

Mouse Leave Event When the user moves the mouse pointer away from a control, the control fires a MouseLeave event. Private Sub Form1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseLeave End Sub

The Key Down Message When a keyboard key is pressed, a message called KeyDown is sent. Private Sub Object_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown End Sub To detect the key, use: e.Keydata or e.kayvalue

Key Press Event When the user presses a key, the KeyPress message is sent. Key pressed for this event should (must) be a character key. Private Sub Object_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress End Sub To detect the key you can use (e.keychar method)

Key Up Event KeyUp message is sent when the user releases the key. Private Sub Object_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp End Sub To detect the key, use: e.keydata e.keyvalue

Keyboard supprot Private Sub Button1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Button1.KeyDown MsgBox(e.KeyData) If e.KeyCode = Keys.A Then MsgBox("a") End If End Sub

Lab Training I Design a digital clock. Design an interface to move an object (button) in different directions as follow: 1.U : up 2.D : down 3.L : left 4.R : right 5.N : right diagonal 6.M : Left diagonal

End