📄 frmbuttons.frm
字号:
VERSION 5.00
Begin VB.Form frmButtons
AutoRedraw = -1 'True
BackColor = &H00C0C0C0&
Caption = "Fig. 12.7: Mouse Buttons "
ClientHeight = 3195
ClientLeft = 2865
ClientTop = 1950
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
Begin VB.Label lblKeys
Caption = "ALT"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 4
Left = 3120
TabIndex = 2
Top = 2520
Width = 1215
End
Begin VB.Label lblKeys
Caption = "CTRL"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 2
Left = 1920
TabIndex = 1
Top = 2520
Width = 975
End
Begin VB.Label lblKeys
Caption = "SHIFT"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 480
TabIndex = 0
Top = 2520
Width = 1215
End
Begin VB.Image imgImage
Height = 1935
Left = 1440
Top = 360
Width = 1695
End
End
Attribute VB_Name = "frmButtons"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 12.7
' Mouse buttons
Option Explicit ' General declaration
Private Sub Form_Load()
imgImage.Picture = LoadPicture("d:\images\ch12\mouse0.gif")
End Sub
Private Sub Form_MouseDown(Button As Integer, _
Shift As Integer, x As Single, _
Y As Single)
Dim a As Integer, c As Integer, s As Integer
a = Shift And vbAltMask ' Mask Alt bit
c = Shift And vbCtrlMask ' Mask Ctrl bit
s = Shift And vbShiftMask ' Mask Shift bit
If (a <> 0) Then ' Alt
lblKeys(a).BackColor = vbGreen
End If
If (s <> 0) Then ' Shift
lblKeys(s).BackColor = vbGreen
End If
If (c <> 0) Then ' Ctrl
lblKeys(c).BackColor = vbGreen
End If
imgImage.Picture = LoadPicture("d:\images\ch12\mouse" & _
Button & ".gif")
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, _
x As Single, Y As Single)
' Change Label BackColors to Form's BackColor
lblKeys(1).BackColor = BackColor
lblKeys(2).BackColor = BackColor
lblKeys(4).BackColor = BackColor
' Load mouse image of unpressed buttons
imgImage.Picture = LoadPicture("d:\images\ch12\mouse0.gif")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -