Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Its me again!

 

I was trying to find everywhere how to hold down some key (for example, "M") and animate a Button so that it looks that it's "pressed". When I release "M" then the button will be released as well (as if I have clicked the button with the key)

 

Button.PerformClick does not show this. In VB6 there was a Value property, which made this possible...

 

Thanks!!!

Posted

Re: Altering Button down state ("pressed") with key

 

Have you tried:

Private Sub Button1_KeyDown(ByVal sender As Object, _
  ByVal e As System.Windows.Forms.KeyEventArgs) Handles Button1.KeyDown
      If e.KeyCode = Keys.M Then
        'MsgBox("do something")
        e.Handled = True
        Button1.FlatStyle = FlatStyle.Flat
      End If
End Sub

Private Sub Button1_KeyUp(ByVal sender As Object, _
   ByVal e As System.Windows.Forms.KeyEventArgs) Handles Button1.KeyUp
      e.Handled = True
      Button1.FlatStyle = FlatStyle.Standard
End Sub

Posted

Re: Altering Button down state ("pressed") with key

 

Ok, I tried it... it's ok, but I would like to see the 'real' button pressed state (because it changes very drastically from a Button to a square)

  • Leaders
Posted

Re: Altering Button down state ("pressed") with key

 

You could use a CheckBox control, setting the Appearance property to "Button." It will look like a normal button, but when the Checked property is set to true, the button will appear to be pressed in.

 

You might want to set AutoCheck to false. Otherwise the button will toggle between pushed and raised when the user clicks on it.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...