By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,967 Members | 815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,967 IT Pros & Developers. It's quick & easy.

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

P: n/a
Mat


Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
* "Mat" <re**********@fuckSpam.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
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
Mat
Thanks you.
i will try it
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uZ**************@TK2MSFTNGP09.phx.gbl...
* "Mat" <re**********@fuckSpam.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
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3

P: n/a
BB
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
-----Original Message-----
.

Nov 20 '05 #4

P: n/a

"BB" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
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.


Nov 20 '05 #5

P: n/a
Mat
Your method is much more better...
Thanks for the TIP . i never know that
"BB" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
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
-----Original Message-----
.

Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.