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

📄 5-1-4.frm

📁 通过使用VB实现动态的字幕滚动的效果,可以用在网页或者课件中
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   """滚动字幕""式"
   ClientHeight    =   3870
   ClientLeft      =   2085
   ClientTop       =   2130
   ClientWidth     =   6165
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   3870
   ScaleWidth      =   6165
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00C0C0C0&
      Height          =   3615
      Left            =   120
      ScaleHeight     =   3555
      ScaleWidth      =   4755
      TabIndex        =   1
      Top             =   120
      Width           =   4815
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000014&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000012&
         Height          =   3255
         Left            =   0
         MultiLine       =   -1  'True
         TabIndex        =   2
         Text            =   "5-1-4.frx":0000
         Top             =   0
         Width           =   4575
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   200
      Left            =   5520
      Top             =   1200
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始"
      Height          =   495
      Left            =   5040
      TabIndex        =   0
      Top             =   240
      Width           =   1095
   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 CurY As Single

Private Sub Command1_Click()
  
  CurY = Picture1.Height
  Timer1.Enabled = True
End Sub

Private Sub Form_Load()
  Dim s As String, nl As String * 2
  
  Timer1.Enabled = False
  Picture1.BackColor = QBColor(0) ' Black
  Text1.BackColor = RGB(0, 0, 0) ' Black
  Text1.ForeColor = &HFF         ' Red
    
  nl = Chr$(13) + Chr$(10)
  Text1 = ""
  Open App.Path + "\test2.txt" For Input As #1
  '打开文件读入数据
  While Not EOF(1)
    Line Input #1, s
    Text1 = Text1 + s + nl
  Wend
  Close #1
    
  Text1.FontSize = 12
  Set Font = Text1.Font
  Text1.Move 0, Picture1.Height     '将文本框移到图片框低部
  Text1.Width = Picture1.Width
  Text1.Height = TextHeight(Text1.Text)
End Sub


Private Sub Timer1_Timer()
  
  Text1.Top = CurY
  CurY = CurY - 100
  If CurY + Text1.Height < 0 Then
    CurY = Picture1.Height
  End If
End Sub


⌨️ 快捷键说明

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