form1.frm
来自「这里有很多很实用的VB编程案例,方便大家学习VB.」· FRM 代码 · 共 111 行
FRM
111 行
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.TextBox Text2
Height = 375
Left = 1920
TabIndex = 4
Text = "0"
Top = 1320
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 1920
TabIndex = 3
Text = "0"
Top = 600
Width = 1335
End
Begin VB.PictureBox Picture1
Height = 135
Left = 2520
ScaleHeight = 135
ScaleWidth = 15
TabIndex = 2
Top = 1800
Width = 15
End
Begin VB.HScrollBar HScroll1
Height = 255
Left = 840
Max = 300
TabIndex = 1
Top = 2640
Width = 2775
End
Begin VB.VScrollBar VScroll1
Height = 2055
Left = 840
Max = 400
TabIndex = 0
Top = 480
Value = 400
Width = 255
End
Begin VB.Label Label2
Caption = "Y:"
Height = 180
Left = 1440
TabIndex = 6
Top = 1320
Width = 270
End
Begin VB.Label Label1
Caption = "X:"
Height = 255
Left = 1440
TabIndex = 5
Top = 600
Width = 375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub HScroll1_Change()
Text1.Text = HScroll1.Value
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
k = CInt(Text1.Text)
If k <= 300 Then
HScroll1.Value = k
End If
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
k = CInt(Text2.Text)
If k <= 400 Then
VScroll1.Value = 400 - k
End If
End If
End Sub
Private Sub VScroll1_Change()
Dim k As Integer
k = VScroll1.Value
k = Abs(k - 400)
Text2.Text = CStr(k)
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?