Mouse Down Event - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Mouse Down Event

CitizenOlekCitizenOlek Posts: 53Member

I have a PictureBox on a Form that increments a value when the Mouse Button is pressed, using the PictureBoxes MouseDown Event! Is there a way to detect if the Mouse Button is being held down and thereby to continuously increment that value until the user releases the Mouse Button?.


  • CitizenOlekCitizenOlek Posts: 53Member
    What I needed here was a Timer Event!
    I'd forgotten about that!

    Works great now.
  • patrickWpatrickW Posts: 1Member
    : What I needed here was a Timer Event!
    : I'd forgotten about that!
    : Works great now.
    Just what I need. Please let us see how you have done it.

  • CitizenOlekCitizenOlek Posts: 53Member
    I pulled a Timer Control from the Toolbox.
    Gave it a name that associated it with my PicBox.
    ex: if the PicBox is pbMoreGold - then timer is tmrMoreGold.
    Using the Mouse Down event of the PicBox I Enable the associated timer.
    In the Timer event I increment my value - More Gold.
    (I'm writing a Game of Conquest)
    The value continues to increment every time the Timer fires.
    Until the Timer shuts off when we detect MouseUp in the PicBox

    I even got fancy with it so that the incrementing goes faster the longer you hold down the Button. Why kept the User waiting? Right?

    Hope that answers that!
Sign In or Register to comment.