form1.frm
来自「这里有很多很实用的VB编程案例,方便大家学习VB.」· FRM 代码 · 共 75 行
FRM
75 行
VERSION 5.00
Begin VB.Form Form1
Caption = "控件焦点"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "按钮3"
Height = 495
Left = 2880
TabIndex = 4
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "按钮2"
Height = 495
Left = 1560
TabIndex = 3
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "按钮1"
Height = 495
Left = 240
TabIndex = 1
Top = 1920
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
Left = 600
TabIndex = 0
Text = "鼠标选择后,单击按钮"
Top = 360
Width = 3015
End
Begin VB.Label Label1
Caption = "Label1"
Height = 495
Left = 600
TabIndex = 2
Top = 960
Width = 3015
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Text1_LostFocus()
If Screen.ActiveControl Is Me.Command1 Then
Label1.Caption = "按到按钮1"
Exit Sub
End If
If Screen.ActiveControl Is Me.Command2 Then
Label1.Caption = "按到按钮2"
Exit Sub
End If
If Screen.ActiveControl Is Me.Command3 Then
Label1.Caption = "按到按钮3"
Exit Sub
End If
Label1.Caption = "进行LostFoucs的处理"
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?