Mouse event handling - PowerPoint PPT Presentation

Loading...

PPT – Mouse event handling PowerPoint presentation | free to download - id: 26ca0c-ZDc1Z



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Mouse event handling

Description:

Create a Graphics class object and use it ... Method FillEllipse draws a circle. graphics- FillEllipse(new SolidBrush ... Set them using the eventhandlers for ... – PowerPoint PPT presentation

Number of Views:234
Avg rating:3.0/5.0
Slides: 6
Provided by: PROFE172
Category:
Tags: event | handling | method | mouse

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Mouse event handling


1
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

2
Mouse events(delegates MouseEventHandler, event
arguments MouseEventArgs)
  • MouseDownraised if the mouse button is pressed
    while its cursor is over the area of the control
  • MouseHoverRaised 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

3
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

4
Graphics
  • Create a Graphics class object and use it to draw
    on the form
  • Graphics graphic CreateGraphics()
  • Method FillEllipse draws a circle
  • graphics-gtFillEllipse(new SolidBrush(ColorBlueVi
    olet),
  • e-gtX,e-gtY,4,4)

5
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 ColorBlue). When
    responsding to the mouse moves, simply use the
    size and color variables to determine the proper
    size and color
About PowerShow.com