How to make button to be pressed(graphically down and stay) when user click on it?

  • Thread starter Thread starter Mat
  • Start date Start date
* "Mat" <replytogroup@****Spam.COM> scripsit:
[Nothing]

\\\
Private Declare Auto Function SendMessage Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32 _
) As Int32

Private Const BM_SETSTATE As Int32 = &HF3
Private Const BM_GETSTATE As Int32 = &HF2

Private m_blnDown As Boolean

..
..
..

Private Sub Timer1_Tick( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs _
) Handles Timer1.Tick
If m_blnDown Then
SendMessage(Me.Button1.Handle, BM_SETSTATE, 0, 0)
Else
SendMessage(Me.Button1.Handle, BM_SETSTATE, 1, 0)
End If
m_blnDown = Not m_blnDown
End Sub
///
 
Mat,

Another suggestion: use a "radio button" instead, and
set .appearance to "button". This will give you a button
that "stays down" when it is "checked".

Bill
 
BB said:
Mat,

Another suggestion: use a "radio button" instead, and
set .appearance to "button". This will give you a button
that "stays down" when it is "checked".

Bill


The same can be used with a checkbox if you dont want a group of them.
 
Back
Top