dcsimg
Results 1 to 3 of 3

Thread: Button still able to be clicked if held outside of it?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2015
    Posts
    36

    Button still able to be clicked if held outside of it?

    So I have a button that if you click on it and hold, and then go off of the button while still holding down...then release outside of the button, it still clicks the button. How can I make that not happen?

    here is the code for the button

    Dim GMButton As New Button
    ' WrestlerImage.Text = me.getName()
    GMButton.Name = "Btn_" & Me.getName()
    GMButton.Size = New Size(148, 100)
    GMButton.Location = New Point((GMGroup.Width / 2) - (GMButton.Width / 2), GMGroup.Height - GMButton.Height)
    GMButton.BackColor = Color.Transparent
    GMButton.ForeColor = Color.Transparent
    GMButton.FlatStyle = FlatStyle.Flat
    GMButton.FlatAppearance.BorderSize = 0
    GMButton.BackgroundImage = My.Resources.Button_Unpressed
    GMButton.FlatAppearance.MouseDownBackColor = Color.Transparent
    GMButton.FlatAppearance.MouseOverBackColor = Color.Transparent
    GMButton.BackgroundImageLayout = ImageLayout.Zoom
    AddHandler GMButton.MouseUp, AddressOf GMButton_Click
    AddHandler GMButton.MouseDown, AddressOf GMButton_Down
    AddHandler GMButton.MouseHover, AddressOf GMButton_Hover
    AddHandler GMButton.MouseLeave, AddressOf GMButton_Leave
    AddHandler GMButton.MouseUp, AddressOf GMButton_Up
    GMGroup.Controls.Add(GMButton)
    displayed = True

  2. #2
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,580

    Re: Button still able to be clicked if held outside of it?

    You associated the MouseUp event with your Click handler AND a MouseUp handler. Odds are you made a copy/paste error. I bet the first AddHandler line meant to add a handler for the Click event.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2015
    Posts
    36

    Re: Button still able to be clicked if held outside of it?

    Quote Originally Posted by Sitten Spynne View Post
    You associated the MouseUp event with your Click handler AND a MouseUp handler. Odds are you made a copy/paste error. I bet the first AddHandler line meant to add a handler for the Click event.
    WOW are you kidding me!? THANK YOU! can't believe i missed that!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width