Using Enter, Shift, and Arrow Keys to control Size and Posistion of a shape

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • perse981
    New Member
    • Sep 2006
    • 3

    Using Enter, Shift, and Arrow Keys to control Size and Posistion of a shape

    Hi

    I need to know how, if even possible, to enable the user of my program to control the Size and Posisiton of the circle I have Drawn on the form by using the Enter Key (to increase size), Shift Key (to decrease size), and Arrow Keys (to alter posistion of circle on screen).

    My program consists of a single form with six command buttons and a circle that I drew with the shape control. For each of the command buttons I have written a click prcedure so that the user can control the size and posistion of the shape by clicking buttons.

    I need to alter this program so that the user can use key strokes instead of mouse clicks to control size and posistion. I also need any command buttons on the form to be invisable to the user so that only the Circle is present in their view.

    I have tried for hours to accomplish this and have failed. Please Help!
  • CaptainD
    New Member
    • Mar 2006
    • 135

    #2
    Sounds like a homework assignment.

    Look into keypress events (Keyup, keydown) Each key has it's own KeyAscii or keycode value assigned to it. This example will show you the key code each time you let off a key that was pressed.

    Code:
    Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    'You can use this to alter the size of your object or any other code you want to run
          MsgBox KeyCode, VBOkOnly, "Key Code Value"
    End Sub

    Comment

    Working...