Is it possible to make a button stick and not pop up when it is pressed like with toolbar buttons? Thanks.
Printable View
Is it possible to make a button stick and not pop up when it is pressed like with toolbar buttons? Thanks.
add the Microsoft Forms 2.0 controls, it includes the Toggle button control
Another way is to just use a check box and set it's style property to "Graphical"
It looks real nice.
Code:'this really looks too cool...
'can't get it to work with the normal button look but
'if I use the sunken 3d effect and call it to set it
'looks really really good...sunken and stays sunken.
'to view it copy and paste this code.
'Form1 Command1
'
Option Explicit
Public PixX, PixY, CTop, Clft, CRgt, CBtm, i, AddX, AddY
Public nowDown As Boolean
Public Sub ThreeDControl(Ctrl As _
Control, nBevel, nSpace, bInset)
PixX = Screen.TwipsPerPixelX
PixY = Screen.TwipsPerPixelY
CTop = Ctrl.Top - PixX
Clft = Ctrl.Left - PixY
CRgt = Ctrl.Left + Ctrl.Width
CBtm = Ctrl.Top + Ctrl.Height
' Color used below:
' dark gray = &H808080
' white = &HFFFFFF
If bInset Then 'inset border
For i = nSpace To (nBevel + nSpace - 1)
AddX = i * PixX
AddY = i * PixY
Ctrl.Parent.Line (Clft - AddX, CTop - _
AddY)-(CRgt + AddX, CTop - AddY), &H808080
Ctrl.Parent.Line (Clft - AddX, CTop - _
AddY)-(Clft - AddX, CBtm + AddY), &H808080
Ctrl.Parent.Line (Clft - AddX, CBtm + _
AddY)-(CRgt + AddX + PixX, CBtm + AddY), &HFFFFFF
Ctrl.Parent.Line (CRgt + AddX, CTop - _
AddY)-(CRgt + AddX, CBtm + AddY), &HFFFFFF
Next
Else 'outset border
For i = nSpace To (nBevel + nSpace - 1)
AddX = i * PixX
AddY = i * PixY
Ctrl.Parent.Line (CRgt + AddX, CBtm + _
AddY)-(CRgt + AddX, CTop - AddY), &H808080
Ctrl.Parent.Line (CRgt + AddX, CBtm + _
AddY)-(Clft - AddX, CBtm + AddY), &H808080
Ctrl.Parent.Line (CRgt + AddX, CTop - _
AddY)-(Clft - AddX - PixX, CTop - AddY), &HFFFFFF
Ctrl.Parent.Line (Clft - AddX, CBtm + _
AddY)-(Clft - AddX, CTop - AddY), &HFFFFFF
Next
End If
End Sub
Private Sub Command1_Click()
If nowDown = False Then
Call ThreeDControl(Command1, 1, 0, True)
Command1.Width = 1215
Command1.Height = 495
nowDown = True
Else
nowDown = False
Command1.Width = 1250
Command1.Height = 525
Command1.Refresh
End If
End Sub
Private Sub Form_Activate()
Call ThreeDControl(Command1, 1, 0, True)
Command1.Width = 1215
Command1.Height = 495
nowDown = True
Call Command1_Click
End Sub