Mouse event handling Mouse events( delegates EventHandler, event arguments EventArgs) MouseEnter: raised if the mouse cursor enters the area of the control.

Slides:



Advertisements
Similar presentations
 Specifies a set of methods (i.e., method headings) that any class that implements that interface must have.  An interface is a type (but is not a class).
Advertisements

Mouse Listeners We continue our examination of GUIs by looking at how to interact with the mouse –Just as Java creates Events when the user interacts with.
COMPUTER PROGRAMMING I Objective 8.03 Apply Animation and Graphic Methods in a Windows Form (4%)
Lab 8: States and Transitions User Interface Lab: GUI Lab Oct. 16 th, 2013.
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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 21 - “Cat and Mouse” Painter Application.
Event Handling Events and Listeners Timers and Animation.
Graphical User Interface (GUI) A GUI allows user to interact with a program visually. GUIs are built from GUI components. A GUI component is an object.
Events. Events Single Event Handlers Click Event Mouse Events Key Board Events Create and handle controls in runtime Outline.
Mouse draw Using the mouse and a palette to make a picture.
Mouse event handling Mouse events( delegates EventHandler, event arguments EventArgs) MouseEnter: raised if the mouse cursor enters the area of the control.
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
Transferring Course Materials to the Web. Creating a Web Site With a Template To create a Web site with a template 1.Start FrontPage. 2.On the File menu,
 A tool that allows you to select through a free hand method › Unlike the marquee which defines the shape of your selection.
Lesson 4-7 Arithmetic Sequences.
CSCI 3327 Visual Basic Chapter 10: Windows Forms GUI: A Deeper Look UTPA – Fall 2011.
Object Oriented Programming Graphical User Interfaces Dr. Mike Spann
Chapter 8: Writing Graphical User Interfaces
Events in C# Events in C#.
CSC 298 Windows Forms.
BIM211 – Visual Programming Objects, Collections, and Events 1.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
Microsoft Word 2000 Presentation 5. Major Word Topics Columns Tables Lists.
Chapter 8: Writing Graphical User Interfaces Visual Basic.NET Programming: From Problem Analysis to Program Design.
Lecture Set 13 Drawing Mouse and Keyboard Events Part B – Mouse and Keyboard Events.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 - Graphical User Interface Concepts: Part.
Java GUI’s are event driven, meaning they generate events when the user interacts with the program. Typical events are moving the mouse, clicking a mouse.
Hello, little turtles. Hello, little turtles! There are many modules in Python that provide very powerful feature that we can use in our own program.
Timer, Animation Responding to Mouse & Keyboard Lab 7 7 McGraw-Hill© 2006 The McGraw-Hill Companies, Inc. All rights reserved.
1 Chapter Eleven Handling Events. 2 Objectives Learn about delegates How to create composed delegates How to handle events How to use the built-in EventHandler.
Events with Data Arguments Data Values Travel with e.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
BIM211 – Visual Programming Interacting with Users Graphics 1.
Introduction to AutoCAD Engineering Drawings
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 21.1 Test-Driving the Painter Application.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 21 - “Cat and Mouse” Painter Application.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
Presented By: Weidong WU, Ph.D. Date: Part I Creating a drawing format for the paper size A (11 x 8.5) 1. Start Pro/E wildfire. 2. File  set.
Microsoft ® Office Excel 2003 Training Excel by Using formulas Mr Garel…… presents:
Mouse Listeners Moving the mouse will also generate events like the Timer –To have your program respond, you must implement either or both of MouseListener.
 2002 Prentice Hall. All rights reserved. 1 Outline Mouse Event Handling Keyboard Event Handling Graphical User Interface Concepts:
Transparency 6 Click the mouse button or press the Space Bar to display the answers.
Ch. 14: Presentations with Graphics and Multimedia – Lesson 87 © 2010, 2006 South-Western, Cengage Learning.
CFC-12 JAVA Simulator. Numerical output table Radio buttons to control time horizon/run start-stop time Run and reset buttons Graphical output window.
Implement User Input Windows Development Fundamentals LESSON 2.4A.
Introduction to JavaScript Events Instructor: Sergey Goldman 1.
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
Visual Basic.NET BASICS Lesson 9 Nested If Statements and Radio Buttons.
10/20/2005week71 Graphics, mouse and mouse motion events, KeyEvent Agenda Classes in AWT for graphics Example java programs –Graphics –Mouse events –Mouse.
 2007 Pearson Education, Inc. All rights reserved Graphical User Interface Concepts: Part 1.
Graphics Graphics Korea University kucg.korea.ac.kr 1 Interaction and Animation 고려대학교 컴퓨터 그래픽스 연구실.
THE MOUSE Left Click THE MOUSE Right Click.
CHAPTER 8 TAMING THE MOUSE
Part II Reference:
Object Oriented Programming
Chapter Eleven Handling Events.
Computer Programming I
JavaScript and Events.
Visual Basic Properties, Methods and Events
Drawing Two-Dimensional Shapes with Digital Technology
Visual programming Chapter 2: Events and Event Handling
for graphical input devices
Self Study GUI Properties & Events
Chapter 13: Handling Events
CHAPTER 8 TAMING THE MOUSE
CHAPTER FOUR VARIABLES AND CONSTANTS
Skills Sheet: ‘Creating a path’
Skills Sheet: ‘Creating a polygon’
Instructions for Accounting Analytics.
Presentation transcript:

Mouse event handling Mouse events( delegates EventHandler, event arguments EventArgs) MouseEnter: raised if the mouse cursor enters the area of the control MoueLeave: raised if the mouse cursor leaves the area of control

Mouse events(delegates MouseEventHandler, event arguments MouseEventArgs) MouseDown:raised if the mouse button is pressed while its cursor is over the area of the control MouseHover:Raised if the mouse cursor hovers over the eara of the control MouseMove: Raised if the mouse cursor is moved while in the area of the control MouseUp: Raised if the mouse button is released when the cursor is over the area of the control

MouseEventArgs properties Button: Mouse button that was pressed(left, right, middle or none) Clicks: the number of times the mouse button (either mouse button) was clicked X: the x-coordinate of the event, relative to the control Y: the y-coordinate of the event, relative to control

Graphics Create a Graphics class object and use it to draw on the form Graphics *graphic = CreateGraphics(); Method FillEllipse draws a circle graphics->FillEllipse(new SolidBrush(Color::BlueViolet), e->X,e->Y,4,4);

Assignment Extend the example to include options for changing the the size and color of the lines drawn Create a drawing area Hint: Have variables to keep track of the currently selected size(int ) and color( Color object ). Set them using the eventhandlers for the radio buttons. For the color, use the various Color constants ( such as Color::Blue). When responsding to the mouse moves, simply use the size and color variables to determine the proper size and color