📄 test.frm
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5745
ClientLeft = 1740
ClientTop = 1530
ClientWidth = 6420
LinkTopic = "Form1"
ScaleHeight = 5745
ScaleWidth = 6420
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 615
Left = 3000
TabIndex = 2
Top = 3240
Width = 2055
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 735
Left = 3120
TabIndex = 1
Top = 1920
Width = 2415
End
Begin ComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 495
Left = 0
TabIndex = 0
Top = 5250
Width = 6420
_ExtentX = 11324
_ExtentY = 873
SimpleText = ""
_Version = 327680
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 1
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
TextSave = ""
Object.Tag = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
StatusBar1.Panels(1).Text = "This is Command1"
End Sub
Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim MouseOver As Boolean
'判断当前鼠标位置是否在Command2上
MouseOver = (0 <= X) And (X <= Command2.Width) And (0 <= Y) And (Y <= Command2.Height)
If MouseOver Then
' 假如鼠标在Command2上, 则利用SetCapture将每一个鼠标事件都传递给Command2
' 并在StatusBar1.Panels(1)上显示帮助信息
StatusBar1.Panels(1).Text = "This is Command2"
SetCapture Command2.hWnd
Else
' 假如鼠标不在Command2上, 则利用SetCapture释放鼠标捕捉
' 并清除在StatusBar1.Panels(1)上的帮助信息
StatusBar1.Panels(1).Text = ""
ReleaseCapture
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
StatusBar1.Panels(1).Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -