⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keycheck.frm

📁 VB键盘记录原代码
💻 FRM
字号:
VERSION 2.00
Begin Form Form1 
   BackColor       =   &H00C0C0C0&
   Caption         =   "KeyCheck"
   ClientHeight    =   5760
   ClientLeft      =   1095
   ClientTop       =   1485
   ClientWidth     =   7365
   Height          =   6165
   KeyPreview      =   -1  'True
   Left            =   1035
   LinkTopic       =   "Form1"
   ScaleHeight     =   5760
   ScaleWidth      =   7365
   Top             =   1140
   Width           =   7485
   Begin Label Label1 
      Alignment       =   2  'Center
      Height          =   495
      Index           =   0
      Left            =   240
      TabIndex        =   0
      Top             =   480
      Width           =   975
   End
End
Option Explicit

Sub Form_KeyDown (keycode As Integer, Shift As Integer)
   label1(3) = keycode
   label1(6) = Shift
End Sub

Sub Form_KeyPress (keyascii As Integer)
   label1(5) = keyascii
End Sub

Sub Form_KeyUp (keycode As Integer, Shift As Integer)
label1(4) = keycode
label1(7) = Shift
End Sub

Sub Form_Load ()
   Dim letterWidth As Integer, letterHeight As Integer
   letterWidth = TextWidth("W")
   letterHeight = TextHeight("W")
   loadlabels letterWidth, letterHeight
   Me.Width = 17 * letterWidth
   Me.Height = 12 * letterHeight
End Sub

Sub Form_MouseDown (button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Integer
If button And 2 Then
   For i = 3 To 7
      label1(i) = ""
   Next i
End If
End Sub

Sub Form_Paint ()
Dim i As Integer
For i = 3 To 7
   outline label1(i)
Next i
End Sub

Sub Label1_MouseDown (index As Integer, button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Integer
If index > 2 Or button = 2 Then
   If button And 2 Then
      For i = 3 To 7
         label1(i) = ""
      Next i
   Else
      label1(index) = ""
   End If
End If
End Sub

Sub loadlabels (lw As Integer, lh As Integer)
   Dim w As Integer, h As Integer, i As Integer
   w = lw * 4
   h = lh * 2
   For i = 0 To 7
      If i Then Load label1(i) '0 already exists
      If i > 2 Then
         label1(i).BorderStyle = 1
         label1(i).BackColor = &H80000005
      Else
         label1(i).BackColor = Me.BackColor
      End If
      label1(i).Width = w
      label1(i).Height = h
      label1(i).Top = (i \ 3) * 1.5 * h + lh
      label1(i).Left = lw + ((i Mod 3) * (w + lw))
      label1(i).Visible = True
   Next i
   label1(0) = "Keydown"
   label1(1) = "Keyup"
   label1(2) = "Keypress"
End Sub

Sub outline (c As Control)
    Dim i As Integer
    Dim ct As Integer, cl As Integer
    Dim cr As Integer, cb As Integer

    If TypeOf c Is Menu Then
        'Don't try this at home,kiddies
    Else
        ct = c.Top - screen.TwipsPerPixelY
        cl = c.Left - screen.TwipsPerPixelX
        cr = c.Left + c.Width
        cb = c.Top + c.Height
        c.Parent.Line (cl, ct)-(cr, ct), &H808080
        c.Parent.Line (cl, ct)-(cl, cb), &H808080
        c.Parent.Line (cl, cb)-(cr, cb), &HFFFFFF
        c.Parent.Line (cr, ct)-(cr, cb), &HFFFFFF
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -