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

📄 form1.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Caption         =   "超过64K的文本显示"
   ClientHeight    =   4200
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6600
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   4200
   ScaleWidth      =   6600
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   495
      Left            =   3960
      TabIndex        =   3
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "显示文本"
      Height          =   495
      Left            =   1440
      TabIndex        =   2
      Top             =   3600
      Width           =   1215
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   480
      Top             =   3600
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.VScrollBar VScroll1 
      Height          =   3255
      Left            =   6240
      TabIndex        =   1
      Top             =   0
      Width           =   255
   End
   Begin VB.TextBox Text1 
      Height          =   3375
      Left            =   0
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   0
      Top             =   0
      Width           =   6135
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim txt()

Private Sub Command1_Click()
    On Error Resume Next
    Dim LINE
    CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
    CommonDialog1.ShowOpen
    Dim nfile As String
    
    If CommonDialog1.FileName <> "" Then
        nfile = CommonDialog1.FileName
    Else
        Exit Sub
    End If
    
    Open nfile For Input As #1 Len = 1024
    Do Until EOF(1)
        LINE = LINE + 1
        ReDim Preserve txt(LINE + 15)
        Line Input #1, txt(LINE)
    Loop
    Close #1
    
    VScroll1.Min = 1
    VScroll1.Max = LINE
    VScroll1.SmallChange = 1
    VScroll1.LargeChange = LINE / 10
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub



Private Sub VScroll1_Change()
    Dim i As Integer
    Dim s As String
    For i = VScroll1.Value To VScroll1.Value + 15
        s = s + txt(i) + vbCrLf
    Next i
    Text1.Text = s
End Sub

⌨️ 快捷键说明

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