📄 5-1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2385
ClientLeft = 60
ClientTop = 345
ClientWidth = 4575
LinkTopic = "Form1"
ScaleHeight = 2385
ScaleWidth = 4575
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "结束"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2760
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "输入"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.Label Label1
Caption = "输入信息显示"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 840
TabIndex = 0
Top = 480
Width = 2175
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim FormWidth As Long
Dim FormHeight As Long
Private Sub Command1_Click()
Dim InPutString As String
InPutString = InputBox("请输入文本信息", "输入", Label1)
'调用InputBox函数获得输入
If Len(InPutString) > 0 Then
'判断输入文本
Label1.Caption = InPutString '在标签中显示输入文本
End If
End Sub
Private Sub Command2_Click()
Dim Rpt As Integer
'显示信息警告
Rpt = MsgBox("程序将要结束,结束吗 ?", vbYesNo + vbExclamation + vbDefaultButton2, "退出警告")
If Rpt = vbYes Then '如果用户选择"是"
Unload Me '结束程序
End If
End Sub
Private Sub Form_Activate()
Dim i As Integer
Dim v As Single
v = (FormHeight - Height) / (FormWidth - Width)
For i = Width To FormWidth Step 10
Width = i
Height = i * v + (FormHeight - v * FormWidth) 'y = kx +b
DoEvents
Next i
End Sub
Private Sub Form_Load()
FormHeight = Height
FormWidth = Width
Width = 0
Height = 0
End Sub
Private Sub Form_Resize()
Top = (Screen.Height - Me.Height) / 2
Left = (Screen.Width - Me.Width) / 2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -