7_f09_mouse_keyboard - The Mouse and Keyboard Mouse A...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
The Mouse and Keyboard Mouse • A pointing device with one or more buttons • Important input device, but not required • User moves physical mouse => – Windows moves a small bitmapped image (mouse cursor) on display device – "Hot spot" points to a precise location on display – Hot spot position constantly updated by low-level logic inside Windows
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Mouse Actions • Button Down, Button Up • Wheel movement • Moving mouse • Clicking – Pressing and releasing a mouse button • Dragging – Moving mouse while a button is pressed down • Double Clicking – Clicking a button twice in succession – Must occur within a set period of time and with mouse cursor in approximately the same place • Form’s SystemInformation class has two properties that give this information: – int DoubleClickTime – Size DoubleClickSize Information about Mouse • More of Form’s SystemInformation Properties: – bool MousePresent – int MouseButtons • Gets number of mouse button on the mouse – bool MouseButtonsSwapped – bool MouseWheelPresent
Background image of page 2
Mouse Events – The “Control ” Class defines 9 mouse events and 9 corresponding protected event handler methods • Form class is derived from Control class – Only one control or form receives mouse events • The one that has its Enabled and Visible properties set to true • If multiple controls are stacked, the enabled visible control on top receives the event – A Form object receives mouse events only when mouse is over its client area • But mouse can be “captured” by a control -- so it can receive mouse events when mouse is not over it Some Basic Mouse Events and Handler Methods • MouseDown OnMouseDown( ) • MouseUp On MouseUp( ) • MouseMove OnMouseMove( ) • MouseWheel On MouseWheel( ) – Delegate for each event: MouseEventHandler – 2 nd argument for each handler: MouseEventArgs • Click OnClick( ) • DoubleClick OnDoubleClick( ) – Delegate for each event: EventHandler – 2 nd argument for each handler: EventArgs
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MouseEventArgs Property • Gives access to read-only properties that come with mouse events – int X Horizontal position of mouse – int Y Vertical position of mouse – MouseButtons Button • MouseButtons enumeration possibilities: – None, Left, Right, Middle » e.g., MouseButtons.Left – Indicates which button or buttons are currently pressed
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

7_f09_mouse_keyboard - The Mouse and Keyboard Mouse A...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online